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

Commit 1424150

Browse files
committed
feat(config): Add 'random' and 'seed' jasmine config options
1 parent 6350050 commit 1424150

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

docs/referenceConf.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ exports.config = {
176176

177177
// Optional: Additional third-party specific capabilities can be
178178
// specified here.
179-
// For a list of BrowserStack specific capabilities, visit
179+
// For a list of BrowserStack specific capabilities, visit
180180
// https://www.browserstack.com/automate/capabilities
181181
},
182182

@@ -297,10 +297,10 @@ exports.config = {
297297
// CAUTION: This will cause your tests to slow down drastically.
298298
restartBrowserBetweenTests: false,
299299

300-
// Protractor will track outstanding $timeouts by default, and report them in
301-
// the error message if Protractor fails to synchronize with Angular in time.
302-
// In order to do this Protractor needs to decorate $timeout.
303-
// CAUTION: If your app decorates $timeout, you must turn on this flag. This
300+
// Protractor will track outstanding $timeouts by default, and report them in
301+
// the error message if Protractor fails to synchronize with Angular in time.
302+
// In order to do this Protractor needs to decorate $timeout.
303+
// CAUTION: If your app decorates $timeout, you must turn on this flag. This
304304
// is false by default.
305305
untrackOutstandingTimeouts: false,
306306

@@ -338,7 +338,11 @@ exports.config = {
338338
// internally compiled to a RegExp.
339339
grep: 'pattern',
340340
// Inverts 'grep' matches
341-
invertGrep: false
341+
invertGrep: false,
342+
// If true, run specs in semi-random order
343+
random: false,
344+
// Set the randomization seed if randomization is turned on
345+
seed: '1234'
342346
},
343347

344348
// Options to be passed to Mocha.

lib/frameworks/jasmine.js

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

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

0 commit comments

Comments
 (0)