Skip to content

Commit 27655d7

Browse files
committed
Docs: Write "Changelog" section for QUnit.config.seed
1 parent 5382fbe commit 27655d7

File tree

5 files changed

+22
-9
lines changed

5 files changed

+22
-9
lines changed

History.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ QUnit 3.0 Roadmap and feedback: https://github.com/qunitjs/qunit/issues/1498
6363

6464
### Fixed
6565

66-
* CLI: Fix support for strict TAP parsers by limiting colors to test names. [#1801](https://github.com/qunitjs/qunit/pull/1801)
67-
* CLI: Fix confusing `--seed` eating the file argument. [#1691](https://github.com/qunitjs/qunit/issues/1691)
66+
* CLI: Fix support for strict [TAP parsers](https://qunitjs.com/api/config/reporters/#tap) by limiting colors to test names. [#1801](https://github.com/qunitjs/qunit/pull/1801)
67+
* CLI: Fix confusing [`--seed` option](https://qunitjs.com/api/config/seed/) eating the file argument. [#1691](https://github.com/qunitjs/qunit/issues/1691)
6868
* CLI: Remove confusing `expected: undefined` under error messages in TAP reporter. [#1794](https://github.com/qunitjs/qunit/pull/1794)
6969
* HTML Reporter: Fix broken "Rerun without max depth" link. [da0c59e101](https://github.com/qunitjs/qunit/commit/da0c59e1016685ecd2b813bba914d33170e7bf98) (see also [91db92dbc5](https://github.com/qunitjs/qunit/commit/91db92dbc50bbbc41c5060a27e7aafd4e073e289), [73c03cf277](https://github.com/qunitjs/qunit/commit/73c03cf27745e179396a6d7c9af011a20d3b9082))
7070
* HTML Reporter: Fix `<label>` to wrap `<select>` for multi-value urlConfig item. [#1773](https://github.com/qunitjs/qunit/pull/1773)
@@ -741,7 +741,7 @@ QUnit 3.0 Roadmap and feedback: https://github.com/qunitjs/qunit/issues/1498
741741
* Core: Reintroduce `QUnit.config.module`.
742742
* Core: Stop splitting URL parameter values by commas.
743743
* Core: New `moduleId`-based filtering.
744-
* Core: Support running tests in pseudo-random order.
744+
* Core: Introduce `QUnit.config.seed` for running tests in pseudo-random order.
745745
* Dump: Fix asymmetrical function dump argument spacing.
746746
* HTML Reporter: Fix escaping of diffs.
747747
* HTML Reporter: Add message explaining missing diff.

bin/qunit.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ program
3838
)
3939
.option('--seed <value>',
4040
'specify a seed to enable randomized ordering of tests.\n'
41-
+ 'set to "true" to generate a new seed.'
41+
+ 'set to "true" to generate a new random seed.'
4242
)
4343
.option('-w, --watch', 'watch files for changes and re-run the test suite')
4444
.parse(process.argv);

docs/api/config/reorder.md

+4
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,7 @@ Note that this feature may lead to unexpected failures if you have non-atomic te
2929
This feature is limited to [browser environments](../../browser.md) by default, as it utilizes the `sessionStorage` API. Set [QUnit.config.storage](./storage.md) to enable this feature in Node.js or in other environments.
3030

3131
The QUnit reorder feature was inspired by Kent Beck, who designed a similar mechanism in JUnit Max for Eclipse. <sup>[[1]](https://topenddevs.com/podcasts/javascript-jabber/episodes/050-jsj-qunit-with-jorn-zaefferer) [[2]](https://www.youtube.com/watch?v=g9ykvSI0gjg) [[3]](https://web.archive.org/web/20141018095913/http://junitmax.com/)</sup>
32+
33+
## See also
34+
35+
* [QUnit.config.seed](./seed.md)

docs/api/config/seed.md

+12-4
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,21 @@ This option is also available as [CLI option](../../cli.md), and as URL query pa
2828

2929
</p>
3030

31-
When set to boolean true, or a string, QUnit will run tests in a [seeded-random order](https://en.wikipedia.org/wiki/Random_seed).
32-
33-
The provided string will be used as the seed in a pseudo-random number generator to ensure that results are reproducible. The randomization will also respect the [reorder](./reorder.md) option if enabled and re-run failed tests first without randomizing them.
31+
When enabled QUnit will run tests in a [seeded-random order](https://en.wikipedia.org/wiki/Random_seed).
3432

3533
Randomly ordering your tests can help identify non-atomic tests which either depend on a previous test or are leaking state to subsequent tests.
3634

37-
If `seed` is boolean true (or set as URL query parameter without a value), then QUnit will generate on-demand a new random value to use as seed. You can then read the seed from `QUnit.config.seed` at runtime, and use it to reproduce the same test sequence later.
35+
The provided string will be used as the seed in a pseudo-random number generator to ensure that results are reproducible. The randomization will respect the [reorder](./reorder.md) option if enabled, such that previously failed tests still run first instead of being shuffled.
36+
37+
If `seed` is set to `true` (or add `?seed` to the URL, without any value), then QUnit will generate a new random seed every time you run the tests. To reproduce a specific random sequence, access the seed from `QUnit.config.seed` via the console.
38+
39+
## Changelog
40+
41+
| [QUnit 2.23.1](https://github.com/qunitjs/qunit/releases/tag/2.23.1) | Add support for CLI `--seed=true`, URL `?seed=true`, and [flat preconfig](./index.md#preconfiguration) `qunit_config_seed=true`.
42+
| [QUnit 2.21.0](https://github.com/qunitjs/qunit/releases/tag/2.21.0) | Introduce [flat preconfig](./index.md#preconfiguration), including `qunit_config_seed=<value>`.
43+
| [QUnit 2.3.0](https://github.com/qunitjs/qunit/releases/tag/2.3.0) | Introduce [QUnit CLI](../../cli.md), including `--seed <value>`.
44+
| [QUnit 2.1.0](https://github.com/qunitjs/qunit/releases/tag/2.1.0) | Introduce [object preconfig](./index.md#preconfiguration), including `QUnit.config.seed = true`.
45+
| [QUnit 1.23.0](https://github.com/qunitjs/qunit/releases/tag/1.23.0) | Introduce `QUnit.config.seed`, with `?seed` as way to generate a new random seed.
3846

3947
## See also
4048

docs/cli.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ Options:
104104
-m, --module <name> run only the specified module
105105
-r, --reporter [name] specify the reporter to use
106106
--require <module> specify a module or script to include before running any tests
107-
--seed [value] specify a seed to re-order your tests
107+
--seed <value> specify a seed to enable randomized ordering of tests.
108+
set to "true" to generate a new random seed.
108109
-w, --watch watch files for changes and re-run the test suite
109110
-h, --help display help for command
110111
```

0 commit comments

Comments
 (0)