added seed, randomTests and randomizeTests property (#11678)

This commit is contained in:
Subhash Sharma
2016-10-03 22:39:49 +09:00
committed by Masahiro Wakame
parent 3a49556c30
commit 2a447aaeb0
2 changed files with 21 additions and 1 deletions
+17
View File
@@ -904,6 +904,23 @@ describe("Custom matcher: 'toBeGoofy'", function () {
});
});
describe("Randomize Tests", function() {
it("should allow randomization of the order of tests", function() {
expect(function() {
var env = jasmine.getEnv();
return env.randomizeTests(true);
}).not.toThrow();
});
it("should allow a seed to be passed in for randomization", function() {
expect(function() {
var env = jasmine.getEnv();
env.randomizeTests(true);
return env.seed(1234);
}).not.toThrow();
});
});
(() => {
// from boot.js
var env = jasmine.getEnv();
+4 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for Jasmine 2.2
// Type definitions for Jasmine 2.4.1
// Project: http://jasmine.github.io/
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Theodore Brown <https://github.com/theodorejb>, David Pärsson <https://github.com/davidparsson/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -180,6 +180,9 @@ declare namespace jasmine {
addMatchers(matchers: CustomMatcherFactories): void;
specFilter(spec: Spec): boolean;
throwOnExpectationFailure(value: boolean): void;
seed: (s: number) => number;
randomTests: () => boolean;
randomizeTests: (b: boolean) => void;
}
interface FakeTimer {