-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
test_runner: support test order randomization #61747
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
Changes from 4 commits
0fb39fa
300a0a9
5745058
d013ca5
cd9a8ee
ae29501
311a65c
85b2a9c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -631,6 +631,94 @@ prevent shell expansion, which can reduce portability across systems. | |||||
| node --test "**/*.test.js" "**/*.spec.js" | ||||||
| ``` | ||||||
|
|
||||||
| ### Randomizing tests execution order | ||||||
|
|
||||||
| <!-- YAML | ||||||
| added: REPLACEME | ||||||
| --> | ||||||
|
|
||||||
| > Stability: 1.0 - Early development | ||||||
|
|
||||||
| The test runner can randomize execution order to help detect | ||||||
| order-dependent tests. When enabled, the runner randomizes both discovered | ||||||
| test files and queued tests within each file. Use `--test-randomize` to | ||||||
| enable this mode. | ||||||
|
|
||||||
| ```bash | ||||||
| node --test --test-randomize | ||||||
Ethan-Arrowood marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| ``` | ||||||
|
|
||||||
| When randomization is enabled, the test runner prints the seed used for the run | ||||||
| as a diagnostic message: | ||||||
|
|
||||||
| ```text | ||||||
| Randomized test order seed: 12345 | ||||||
| ``` | ||||||
|
|
||||||
| Use `--test-random-seed=<number>` to replay the same randomized order | ||||||
| deterministically. Supplying `--test-random-seed` also enables randomization, | ||||||
| so `--test-randomize` is optional when a seed is provided: | ||||||
|
|
||||||
| ```bash | ||||||
| node --test --test-randomize --test-random-seed=12345 | ||||||
|
||||||
| node --test --test-randomize --test-random-seed=12345 | |
| node --test --test-random-seed=12345 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is in reference to the previous line of text that states the --test-randomize is not needed when --test-random-seed is provided.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I thiiink it should be "enqueued"? "queued" together means they wait together; enqueued together means they're added to a queue one-by-one setting up a sequence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets mention the 0 to 2^32 - 1 limit here.
Uh oh!
There was an error while loading. Please reload this page.