From 2a447aaeb05e1047b79114e8a53480f9ee9eefec Mon Sep 17 00:00:00 2001 From: Subhash Sharma Date: Mon, 3 Oct 2016 19:09:49 +0530 Subject: [PATCH] added seed, randomTests and randomizeTests property (#11678) --- jasmine/jasmine-tests.ts | 17 +++++++++++++++++ jasmine/jasmine.d.ts | 5 ++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/jasmine/jasmine-tests.ts b/jasmine/jasmine-tests.ts index d873d2716b..96ac307ca0 100644 --- a/jasmine/jasmine-tests.ts +++ b/jasmine/jasmine-tests.ts @@ -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(); diff --git a/jasmine/jasmine.d.ts b/jasmine/jasmine.d.ts index 538aca3fb6..4eb2a054a1 100644 --- a/jasmine/jasmine.d.ts +++ b/jasmine/jasmine.d.ts @@ -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 , Theodore Brown , David Pärsson // 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 {