Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 6ebee72

Browse files
szimekcnishina
authored andcommitted
feat(config): Add 'random' and 'seed' jasmine config options (#3467)
1 parent e5f4f66 commit 6ebee72

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

lib/config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,14 @@ export interface Config {
519519
* Inverts 'grep' matches
520520
*/
521521
invertGrep?: boolean;
522+
/**
523+
* If true, run specs in semi-random order
524+
*/
525+
random?: boolean,
526+
/**
527+
* Set the randomization seed if randomization is turned on
528+
*/
529+
seed?: string,
522530
};
523531

524532
/**

lib/frameworks/jasmine.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ exports.run = function(runner, specs) {
8787
return true;
8888
};
8989

90+
// Run specs in semi-random order
91+
if (jasmineNodeOpts.random) {
92+
jasmine.getEnv().randomizeTests(true);
93+
94+
// Sets the randomization seed if randomization is turned on
95+
if (jasmineNodeOpts.seed) {
96+
jasmine.getEnv().seed(jasmineNodeOpts.seed);
97+
}
98+
}
99+
90100
return runner.runTestPreparer().then(function() {
91101
return q.promise(function(resolve, reject) {
92102
if (jasmineNodeOpts && jasmineNodeOpts.defaultTimeoutInterval) {

0 commit comments

Comments
 (0)