Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge latest upstream changes #16

Merged
merged 46 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
c114665
APT-328 - Implement jest.spyOn (#382)
Mar 11, 2024
8493214
#nojira Fix misconception in comment (#383)
Mar 19, 2024
b5532c9
UIBLOX-667: Update jest mock type (#385)
Mar 21, 2024
95b56ba
APT-1452 dom to fs path resolution in jest-runner for jest-vscode rec…
Mar 26, 2024
367376a
Release 3.7.0 (#386)
Apr 11, 2024
957db88
Mock task wait (#388)
May 20, 2024
b36247c
Configure Jest to use the Registry (#390)
May 21, 2024
99cf609
#nojira fix mismatched test paths between reporter and runner (#395)
Jun 18, 2024
f2997b0
v3.8.1 (#396)
Jun 18, 2024
80689cb
APT-597 mock lua globals (#397)
Jul 24, 2024
ab2f716
APT-1775 Optimistic protected instance property indexing (#398)
Jul 30, 2024
636ceae
APT-1023 APT-1778 Update links and fix static assets (#400)
Jul 31, 2024
4a6463a
APT-1808 update manifests, release 3.9.0 (#402)
Aug 2, 2024
29a9f4c
v3.9.1, fix type in runtime (#403)
Aug 2, 2024
60586d7
APT-1797 More helpful error when requiring `JestGlobals` outside a te…
Aug 12, 2024
70f4243
APT-1523 fallback to loadstring if loadmodule not enabled (#392)
Aug 16, 2024
6260e59
Merge remote-tracking branch 'roblox/master' into upgrade
vocksel Aug 17, 2024
82180db
Setup JestMockGenv for publish
vocksel Aug 17, 2024
9421d94
Fix require paths
vocksel Aug 17, 2024
f8f4642
APT-1766 Better error snapshots (#401)
Aug 19, 2024
2e93649
APT-1805 add JestBenchmark to the documentation page (#406)
Aug 26, 2024
d6f8904
APT-1837 Protect against bad plugin table reads (#407)
Aug 28, 2024
1a47a0d
APT-1826 Stabilise RobloxInstance "serialises Folder" test. (#408)
Aug 29, 2024
c6b3875
Release 3.10.0 (#411)
Oct 2, 2024
496d53c
Point to right directory for jest-mock-genv
vocksel Oct 6, 2024
89aa9da
Run yarn install
vocksel Oct 6, 2024
ad39aa4
bump rbx-aged-tool (#412)
Oct 9, 2024
0d5efe3
APT-1913 Inject alike types (#409)
Oct 10, 2024
f0ef8f3
Update package dependencies to include jest-mock-genv
vocksel Oct 12, 2024
6a38f84
Add linker module to roblox-model
vocksel Oct 12, 2024
cd1d2df
Merge remote-tracking branch 'roblox/master' into upgrade
vocksel Oct 12, 2024
045a967
Adding back newlines
vocksel Oct 12, 2024
66af8e3
Spruce up lockfile
vocksel Oct 12, 2024
102c75d
Fix require paths
vocksel Oct 12, 2024
8f9d93d
APT-2003 Disallow require by string for now (#414)
Oct 18, 2024
b1630d7
Fix a few remaining Roblox requires
jeparlefrancais Oct 21, 2024
44ef2a5
Bump darklua version
jeparlefrancais Oct 21, 2024
c39faf6
Specify node version 22
jeparlefrancais Oct 21, 2024
ea3e2d0
APT-1914 spyOn callable tables (#413)
Oct 22, 2024
951016f
APT-2175 Quantum stability for RobloxInstance (#416)
Nov 6, 2024
8e41224
APT-2004 Add instance mocking classes (#418)
Nov 12, 2024
bd487e9
Merge remote-tracking branch 'upstream/master' into upgrade
vocksel Nov 20, 2024
534b47d
Add jest-mock-rbx package
vocksel Nov 20, 2024
74539f4
Update release workflow
vocksel Nov 20, 2024
569d5d9
Fix build
vocksel Nov 20, 2024
cfa459f
Get tests running via `yarn test`
vocksel Nov 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ roblox.toml
.vscode/launch.json
.idea
.vscode

jest_runner_tmp
lcov.info
rbx-aged-tool.log
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,29 @@
* fix warning when multiple configuration are found ([#8](https://github.com/jsdotlua/jest-lua/pull/8))
* fix error message when no tests are found ([#7](https://github.com/jsdotlua/jest-lua/pull/7))

## 3.9.1 (2024-08-02)
* :bug: Fix a type analysis error in `JestRuntime` ([#403](https://github.com/Roblox/jest-roblox-internal/pull/403))

## 3.9.0 (2024-08-02)
* :sparkles: Support spying on Lua globals with `spyOn` ([#397](https://github.com/Roblox/jest-roblox-internal/pull/397))
* :bug: Expose safe APIs to read and write Roblox Instance properties in the `RobloxInstance` library for `PrettyFormat` to serialize Instances safely ([#398](https://github.com/Roblox/jest-roblox-internal/pull/398))
* :hammer_and_wrench: Clean up package manifests, READMEs and documentation ([#400](https://github.com/Roblox/jest-roblox-internal/pull/400) [#402](https://github.com/Roblox/jest-roblox-internal/pull/402))

## 3.8.1 (2024-06-18)
* :bug: Fix mismatched test paths between reporter and runner ([#396](https://github.com/Roblox/jest-roblox-internal/pull/395))

## 3.8.0 (2024-05-20)
* :sparkles: Mock task.wait ([#388](https://github.com/Roblox/jest-roblox-internal/pull/373))

## 3.7.0 (2024-04-10)
* :sparkles: Resolve DOM paths to FS paths if possible in `JestRunner` ([#373](https://github.com/Roblox/jest-roblox-internal/pull/373))

## 3.6.2 (2024-03-21)
* :sparkles: Added jest.spyOn ([#382](https://github.com/Roblox/jest-roblox-internal/pull/382))
* :bug: Fixed jest.mock type ([#385](https://github.com/Roblox/jest-roblox-internal/pull/385))

## 3.6.1 (2024-01-16)
* Re-release of 3.6.0 with widened promise dependency that includes older versions for maximum flexibility ([#378](https://github.com/Roblox/jest-roblox-internal/pull/378))
* :hammer_and_wrench: Re-release of 3.6.0 with widened promise dependency that includes older versions for maximum flexibility ([#378](https://github.com/Roblox/jest-roblox-internal/pull/378))

## 3.6.0 (2024-01-09)
* :hammer_and_wrench: Upgrade promise dependency, but keep constraint wide so that all future 3.x versions are valid ([#374](https://github.com/Roblox/jest-roblox-internal/pull/374))
Expand Down
6 changes: 6 additions & 0 deletions bin/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@ robloxdev-cli run --load.model jest.project.json \
EnableSignalBehavior=true DebugForceDeferredSignalBehavior=true MaxDeferReentrancyDepth=15 \
--lua.globals=UPDATESNAPSHOT=false --lua.globals=CI=false --load.asRobloxScript --fs.readwrite="$(pwd)"

echo "Running low privilege tests"
robloxdev-cli run --load.model jest.project.json \
--run bin/spec.lua --testService.errorExitCode=1 \
--fastFlags.overrides EnableLoadModule=false --load.asRobloxScript

# Uncomment this to update snapshots
# robloxdev-cli run --load.model jest.project.json --run bin/spec.lua --testService.errorExitCode=1 --fastFlags.allOnLuau --fastFlags.overrides EnableLoadModule=true DebugDisableOptimizedBytecode=true --lua.globals=UPDATESNAPSHOT=true --lua.globals=CI=true --load.asRobloxScript --fs.readwrite="$(pwd)"
40 changes: 21 additions & 19 deletions docs/docs/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
id: cli
title: runCLI Options
---
<p><a href='https://jestjs.io/docs/27.x/cli' target="_blank"><img alt='Jest' src='img/jestjs.svg'/></a></p> <img alt='Deviation' src='img/deviation.svg'/>
[![Jest](/img/jestjs.svg)](https://jest-archive-august-2023.netlify.app/docs/27.x/cli)

![Deviation](/img/deviation.svg)

The `Jest` packages exports `runCLI`, which is the main entrypoint to run Jest Lua tests. In your entrypoint script, import `runCLI` from the `Jest` package. A basic entrypoint script can look like the following:

Expand Down Expand Up @@ -49,47 +51,47 @@ import TOCInline from "@theme/TOCInline";
## Reference

### `ci` \[boolean]
<a href='https://jestjs.io/docs/27.x/cli#--ci' target="_blank"><img alt='Jest' src='img/jestjs.svg'/></a> <img alt='Aligned' src='img/aligned.svg'/>
[![Jest](/img/jestjs.svg)](https://jest-archive-august-2023.netlify.app/docs/27.x/cli#--ci) ![Aligned](/img/aligned.svg)

When this option is provided, Jest Lua will assume it is running in a CI environment. This changes the behavior when a new snapshot is encountered. Instead of the regular behavior of storing a new snapshot automatically, it will fail the test and require Jest Lua to be run with `updateSnapshot`.

### `clearMocks` \[boolean]
<a href='https://jestjs.io/docs/27.x/cli#--clearmocks' target="_blank"><img alt='Jest' src='img/jestjs.svg'/></a> <img alt='Aligned' src='img/aligned.svg'/>
[![Jest](/img/jestjs.svg)](https://jest-archive-august-2023.netlify.app/docs/27.x/cli#--clearmocks) ![Aligned](/img/aligned.svg)

Automatically clear mock calls, instances, contexts and results before every test. Equivalent to calling [`jest.clearAllMocks()`](jest-object#jestclearallmocks) before each test. This does not remove any mock implementation that may have been provided.

### `debug` \[boolean]
<a href='https://jestjs.io/docs/27.x/cli#--debug' target="_blank"><img alt='Jest' src='img/jestjs.svg'/></a> <img alt='Aligned' src='img/aligned.svg'/>
[![Jest](/img/jestjs.svg)](https://jest-archive-august-2023.netlify.app/docs/27.x/cli#--debug) ![Aligned](/img/aligned.svg)

Print debugging info about your Jest config.

### `expand` \[boolean]
<a href='https://jestjs.io/docs/27.x/cli#--expand' target="_blank"><img alt='Jest' src='img/jestjs.svg'/></a> <img alt='Aligned' src='img/aligned.svg'/>
[![Jest](/img/jestjs.svg)](https://jest-archive-august-2023.netlify.app/docs/27.x/cli#--expand) ![Aligned](/img/aligned.svg)

Use this flag to show full diffs and errors instead of a patch.

### `json` \[boolean]
<a href='https://jestjs.io/docs/27.x/cli#--json' target="_blank"><img alt='Jest' src='img/jestjs.svg'/></a> <img alt='Aligned' src='img/aligned.svg'/>
[![Jest](/img/jestjs.svg)](https://jest-archive-august-2023.netlify.app/docs/27.x/cli#--json) ![Aligned](/img/aligned.svg)

Prints the test results in JSON. This mode will send all other test output and user messages to stderr.

### `listTests` \[boolean]
<a href='https://jestjs.io/docs/27.x/cli#--listtests' target="_blank"><img alt='Jest' src='img/jestjs.svg'/></a> <img alt='Aligned' src='img/aligned.svg'/>
[![Jest](/img/jestjs.svg)](https://jest-archive-august-2023.netlify.app/docs/27.x/cli#--listtests) ![Aligned](/img/aligned.svg)

Lists all test files that Jest Lua will run given the arguments, and exits.

### `noStackTrace` \[boolean]
<a href='https://jestjs.io/docs/27.x/cli#--nostacktrace' target="_blank"><img alt='Jest' src='img/jestjs.svg'/></a> <img alt='Aligned' src='img/aligned.svg'/>
[![Jest](/img/jestjs.svg)](https://jest-archive-august-2023.netlify.app/docs/27.x/cli#--nostacktrace) ![Aligned](/img/aligned.svg)

Disables stack trace in test results output.

### `passWithNoTests` \[boolean]
<a href='https://jestjs.io/docs/27.x/cli#--passwithnotests' target="_blank"><img alt='Jest' src='img/jestjs.svg'/></a> <img alt='Aligned' src='img/aligned.svg'/>
[![Jest](/img/jestjs.svg)](https://jest-archive-august-2023.netlify.app/docs/27.x/cli#--passwithnotests) ![Aligned](/img/aligned.svg)

Allows the test suite to pass when no files are found.

### `resetMocks` \[boolean]
<a href='https://jestjs.io/docs/27.x/cli#--resetmocks' target="_blank"><img alt='Jest' src='img/jestjs.svg'/></a> <img alt='Aligned' src='img/aligned.svg'/>
[![Jest](/img/jestjs.svg)](https://jest-archive-august-2023.netlify.app/docs/27.x/cli#--resetmocks) ![Aligned](/img/aligned.svg)

Automatically reset mock state before every test. Equivalent to calling [`jest.resetAllMocks()`](jest-object#jestresetallmocks) before each test. This will lead to any mocks having their fake implementations removed but does not restore their initial implementation.

Expand All @@ -98,17 +100,17 @@ Automatically reset mock state before every test. Equivalent to calling [`jest.r
Automatically restore mock state and implementation before every test. Equivalent to calling [`jest.restoreAllMocks()`](JestObjectAPI.md#jestrestoreallmocks) before each test. This will lead to any mocks having their fake implementations removed and restores their initial implementation. -->

### `showConfig` \[boolean]
<a href='https://jestjs.io/docs/27.x/cli#--showconfig' target="_blank"><img alt='Jest' src='img/jestjs.svg'/></a> <img alt='Aligned' src='img/aligned.svg'/>
[![Jest](/img/jestjs.svg)](https://jest-archive-august-2023.netlify.app/docs/27.x/cli#--showconfig) ![Aligned](/img/aligned.svg)

Print your Jest config and then exits.

### `testMatch` \[array&lt;string&gt;]
<a href='https://jestjs.io/docs/27.x/cli#--testmatch-glob1--globn' target="_blank"><img alt='Jest' src='img/jestjs.svg'/></a> <img alt='API change' src='img/apichange.svg'/>
[![Jest](/img/jestjs.svg)](https://jest-archive-august-2023.netlify.app/docs/27.x/cli#--testmatch-glob1--globn) ![API Change](/img/apichange.svg)

The glob patterns Jest uses to detect test files. Please refer to the [`testMatch` configuration](configuration#testmatch-arraystring) for details.

### `testNamePattern` \[regex]
<a href='https://jestjs.io/docs/27.x/cli#--testnamepatternregex' target="_blank"><img alt='Jest' src='img/jestjs.svg'/></a> <img alt='Aligned' src='img/aligned.svg'/>
[![Jest](/img/jestjs.svg)](https://jest-archive-august-2023.netlify.app/docs/27.x/cli#--testnamepatternregex) ![Aligned](/img/aligned.svg)

Run only tests with a name that matches the regex. For example, suppose you want to run only tests related to authorization which will have names like "GET /api/posts with auth", then you can use `testNamePattern = "auth"`.

Expand All @@ -119,26 +121,26 @@ The regex is matched against the full name, which is a combination of the test n
:::

### `testPathIgnorePatterns` \[array&lt;regex&gt;]
<a href='https://jestjs.io/docs/27.x/cli#--testpathignorepatternsregexarray' target="_blank"><img alt='Jest' src='img/jestjs.svg'/></a> <img alt='API change' src='img/apichange.svg'/>
[![Jest](/img/jestjs.svg)](https://jest-archive-august-2023.netlify.app/docs/27.x/cli#--testpathignorepatternsregexarray) ![API Change](/img/apichange.svg)

An array of regexp pattern strings that are tested against all tests paths before executing the test. Contrary to `testPathPattern`, it will only run those tests with a path that does not match with the provided regexp expressions.

### `testPathPattern` \[regex]
<a href='https://jestjs.io/docs/27.x/cli#--testpathpatternregex' target="_blank"><img alt='Jest' src='img/jestjs.svg'/></a> <img alt='Aligned' src='img/aligned.svg'/>
[![Jest](/img/jestjs.svg)](https://jest-archive-august-2023.netlify.app/docs/27.x/cli#--testpathpatternregex) ![Aligned](/img/aligned.svg)

A regexp pattern string that is matched against all tests paths before executing the test.

### `testTimeout` \[number>]
<a href='https://jestjs.io/docs/27.x/cli#--testtimeoutnumber' target="_blank"><img alt='Jest' src='img/jestjs.svg'/></a> <img alt='Aligned' src='img/aligned.svg'/>
[![Jest](/img/jestjs.svg)](https://jest-archive-august-2023.netlify.app/docs/27.x/cli#--testtimeoutnumber) ![Aligned](/img/aligned.svg)

Default timeout of a test in milliseconds. Default value: 5000.

### `updateSnapshot` \[boolean]
<a href='https://jestjs.io/docs/27.x/cli#--updatesnapshot' target="_blank"><img alt='Jest' src='img/jestjs.svg'/></a> <img alt='Aligned' src='img/aligned.svg'/>
[![Jest](/img/jestjs.svg)](https://jest-archive-august-2023.netlify.app/docs/27.x/cli#--updatesnapshot) ![Aligned](/img/aligned.svg)

Use this flag to re-record every snapshot that fails during this test run. Can be used together with a test suite pattern or with `testNamePattern` to re-record snapshots.

### `verbose` \[boolean]
<a href='https://jestjs.io/docs/27.x/cli#--verbose' target="_blank"><img alt='Jest' src='img/jestjs.svg'/></a> <img alt='Aligned' src='img/aligned.svg'/>
[![Jest](/img/jestjs.svg)](https://jest-archive-august-2023.netlify.app/docs/27.x/cli#--verbose) ![Aligned](/img/aligned.svg)

Display individual test results with the test suite hierarchy.
Display individual test results with the test suite hierarchy.
Loading
Loading