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

Commit

Permalink
feat(config): Add 'random' and 'seed' jasmine config options (#3467)
Browse files Browse the repository at this point in the history
  • Loading branch information
szimek authored and cnishina committed Nov 7, 2016
1 parent e5f4f66 commit 6ebee72
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,14 @@ export interface Config {
* Inverts 'grep' matches
*/
invertGrep?: boolean;
/**
* If true, run specs in semi-random order
*/
random?: boolean,
/**
* Set the randomization seed if randomization is turned on
*/
seed?: string,
};

/**
Expand Down
10 changes: 10 additions & 0 deletions lib/frameworks/jasmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ exports.run = function(runner, specs) {
return true;
};

// Run specs in semi-random order
if (jasmineNodeOpts.random) {
jasmine.getEnv().randomizeTests(true);

// Sets the randomization seed if randomization is turned on
if (jasmineNodeOpts.seed) {
jasmine.getEnv().seed(jasmineNodeOpts.seed);
}
}

return runner.runTestPreparer().then(function() {
return q.promise(function(resolve, reject) {
if (jasmineNodeOpts && jasmineNodeOpts.defaultTimeoutInterval) {
Expand Down

0 comments on commit 6ebee72

Please sign in to comment.