QUnit.config.seed
version added: 1.23.0.
Description
Enable randomized ordering of tests.
type | string or boolean or undefined |
---|---|
default | undefined |
This option is also available as CLI option, and as URL query parameter in the browser.
When enabled QUnit will run tests in a seeded-random order.
Randomly ordering your tests can help identify non-atomic tests which either depend on a previous test or are leaking state to subsequent tests.
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 option if enabled, such that previously failed tests still run first instead of being shuffled.
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.
Changelog
QUnit 2.23.1 | Add support for CLI --seed=true , URL ?seed=true , and flat preconfig qunit_config_seed=true . |
QUnit 2.21.0 | Introduce flat preconfig, including qunit_config_seed=<value> . |
QUnit 2.3.0 | Introduce QUnit CLI, including --seed <value> . |
QUnit 2.1.0 | Introduce object preconfig, including QUnit.config.seed = true . |
QUnit 1.23.0 | Introduce QUnit.config.seed , with ?seed as way to generate a new random seed. |