mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 07:40:10 +00:00
[jasmine] Add definition for jasmine.Env.configure and mark methods as deprecated (#40013)
* Add definition for jasmine.Env.configure and mark Env methods throwOnExpectationFailure, stopOnSpecFailure, seed and randomizeTests as deprecated * Rename Configuration to EnvConfiguration to prevent possible naaming conflicts * Synchronize files in ts3.1 and root * Move EnvConfiguration to jasmine namespace
This commit is contained in:
committed by
Nathan Shively-Sanders
parent
7664182296
commit
64de1d9aec
27
types/jasmine/index.d.ts
vendored
27
types/jasmine/index.d.ts
vendored
@@ -14,6 +14,7 @@
|
||||
// Stephen Farrar <https://github.com/stephenfarrar>
|
||||
// Mochamad Arfin <https://github.com/ndunks>
|
||||
// Alex Povar <https://github.com/zvirja>
|
||||
// Dominik Ehrenberg <https://github.com/djungowski>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
// For ddescribe / iit use : https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/karma-jasmine/karma-jasmine.d.ts
|
||||
@@ -203,6 +204,18 @@ declare namespace jasmine {
|
||||
(ReadonlyArray<string> | { [methodName: string]: any }) :
|
||||
(ReadonlyArray<keyof T> | { [P in keyof T]?: T[P] extends Func ? ReturnType<T[P]> : any });
|
||||
|
||||
/**
|
||||
* Configuration that can be used when configuring Jasmine via {@link jasmine.Env.configure}
|
||||
*/
|
||||
interface EnvConfiguration {
|
||||
random?: boolean;
|
||||
seed?: number;
|
||||
failFast?: boolean;
|
||||
oneFailurePerSpec?: boolean;
|
||||
hideDisabled?: boolean;
|
||||
specFilter?: Function;
|
||||
}
|
||||
|
||||
function clock(): Clock;
|
||||
|
||||
var matchersUtil: MatchersUtil;
|
||||
@@ -371,14 +384,28 @@ declare namespace jasmine {
|
||||
addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
|
||||
addMatchers(matchers: CustomMatcherFactories): void;
|
||||
specFilter(spec: Spec): boolean;
|
||||
/**
|
||||
* @deprecated Use oneFailurePerSpec option in {@link jasmine.Env.configure} instead.
|
||||
*/
|
||||
throwOnExpectationFailure(value: boolean): void;
|
||||
/**
|
||||
* @deprecated Use failFast option in {@link jasmine.Env.configure} instead.
|
||||
*/
|
||||
stopOnSpecFailure(value: boolean): void;
|
||||
/**
|
||||
* @deprecated Use seed option in {@link jasmine.Env.configure} instead.
|
||||
*/
|
||||
seed(seed: string | number): string | number;
|
||||
provideFallbackReporter(reporter: Reporter): void;
|
||||
throwingExpectationFailures(): boolean;
|
||||
allowRespy(allow: boolean): void;
|
||||
randomTests(): boolean;
|
||||
/**
|
||||
* @deprecated Use random option in {@link jasmine.Env.configure} instead.
|
||||
*/
|
||||
randomizeTests(b: boolean): void;
|
||||
clearReporters(): void;
|
||||
configure(configuration: EnvConfiguration): void;
|
||||
}
|
||||
|
||||
interface FakeTimer {
|
||||
|
||||
@@ -1413,15 +1413,19 @@ describe("Randomize Tests", () => {
|
||||
it("should allow randomization of the order of tests", () => {
|
||||
expect(() => {
|
||||
const env = jasmine.getEnv();
|
||||
env.randomizeTests(true);
|
||||
env.configure({
|
||||
random: true
|
||||
});
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it("should allow a seed to be passed in for randomization", () => {
|
||||
expect(() => {
|
||||
const env = jasmine.getEnv();
|
||||
env.randomizeTests(true);
|
||||
return env.seed(1234);
|
||||
env.configure({
|
||||
random: true,
|
||||
seed: 1234
|
||||
});
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
27
types/jasmine/ts3.1/index.d.ts
vendored
27
types/jasmine/ts3.1/index.d.ts
vendored
@@ -13,6 +13,7 @@
|
||||
// Stephen Farrar <https://github.com/stephenfarrar>
|
||||
// Mochamad Arfin <https://github.com/ndunks>
|
||||
// Alex Povar <https://github.com/zvirja>
|
||||
// Dominik Ehrenberg <https://github.com/djungowski>
|
||||
// For ddescribe / iit use : https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/karma-jasmine/karma-jasmine.d.ts
|
||||
|
||||
/**
|
||||
@@ -206,6 +207,18 @@ declare namespace jasmine {
|
||||
(ReadonlyArray<string> | { [methodName: string]: any }) :
|
||||
(ReadonlyArray<keyof T> | { [P in keyof T]?: T[P] extends Func ? ReturnType<T[P]> : any });
|
||||
|
||||
/**
|
||||
* Configuration that can be used when configuring Jasmine via {@link jasmine.Env.configure}
|
||||
*/
|
||||
interface EnvConfiguration {
|
||||
random?: boolean;
|
||||
seed?: number;
|
||||
failFast?: boolean;
|
||||
oneFailurePerSpec?: boolean;
|
||||
hideDisabled?: boolean;
|
||||
specFilter?: Function;
|
||||
}
|
||||
|
||||
function clock(): Clock;
|
||||
|
||||
var matchersUtil: MatchersUtil;
|
||||
@@ -374,14 +387,28 @@ declare namespace jasmine {
|
||||
addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
|
||||
addMatchers(matchers: CustomMatcherFactories): void;
|
||||
specFilter(spec: Spec): boolean;
|
||||
/**
|
||||
* @deprecated Use oneFailurePerSpec option in {@link jasmine.Env.configure} instead.
|
||||
*/
|
||||
throwOnExpectationFailure(value: boolean): void;
|
||||
/**
|
||||
* @deprecated Use failFast option in {@link jasmine.Env.configure} instead.
|
||||
*/
|
||||
stopOnSpecFailure(value: boolean): void;
|
||||
/**
|
||||
* @deprecated Use seed option in {@link jasmine.Env.configure} instead.
|
||||
*/
|
||||
seed(seed: string | number): string | number;
|
||||
provideFallbackReporter(reporter: Reporter): void;
|
||||
throwingExpectationFailures(): boolean;
|
||||
allowRespy(allow: boolean): void;
|
||||
randomTests(): boolean;
|
||||
/**
|
||||
* @deprecated Use random option in {@link jasmine.Env.configure} instead.
|
||||
*/
|
||||
randomizeTests(b: boolean): void;
|
||||
clearReporters(): void;
|
||||
configure(configuration: EnvConfiguration): void;
|
||||
}
|
||||
|
||||
interface FakeTimer {
|
||||
|
||||
@@ -1413,15 +1413,19 @@ describe("Randomize Tests", () => {
|
||||
it("should allow randomization of the order of tests", () => {
|
||||
expect(() => {
|
||||
const env = jasmine.getEnv();
|
||||
env.randomizeTests(true);
|
||||
env.configure({
|
||||
random: true
|
||||
});
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it("should allow a seed to be passed in for randomization", () => {
|
||||
expect(() => {
|
||||
const env = jasmine.getEnv();
|
||||
env.randomizeTests(true);
|
||||
return env.seed(1234);
|
||||
env.configure({
|
||||
random: true,
|
||||
seed: 1234
|
||||
});
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user