diff --git a/types/jasmine/v2/index.d.ts b/types/jasmine/v2/index.d.ts index 4211cf2ca0..dc0bc6606f 100644 --- a/types/jasmine/v2/index.d.ts +++ b/types/jasmine/v2/index.d.ts @@ -13,6 +13,8 @@ // TypeScript Version: 2.8 // For ddescribe / iit use : https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/karma-jasmine/karma-jasmine.d.ts +type ImplementationCallback = (() => Promise) | ((done: DoneFn) => void); + /** * Create a group of specs (often called a suite). * @param description Textual description of the group @@ -29,7 +31,7 @@ declare function xdescribe(description: string, specDefinitions: () => void): vo * @param assertion Function that contains the code of your test. If not provided the test will be pending. * @param timeout Custom timeout for an async spec. */ -declare function it(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; +declare function it(expectation: string, assertion?: ImplementationCallback, timeout?: number): void; /** * A focused it @@ -38,8 +40,8 @@ declare function it(expectation: string, assertion?: (done: DoneFn) => void, tim * @param assertion * @param timeout */ -declare function fit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; -declare function xit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; +declare function fit(expectation: string, assertion?: ImplementationCallback, timeout?: number): void; +declare function xit(expectation: string, assertion?: ImplementationCallback, timeout?: number): void; /** * Mark a spec as pending, expectation results will be ignored. @@ -54,14 +56,14 @@ declare function pending(reason?: string): void; * @param action Function that contains the code to setup your specs. * @param timeout Custom timeout for an async beforeEach. */ -declare function beforeEach(action: (done: DoneFn) => void, timeout?: number): void; +declare function beforeEach(action: ImplementationCallback, timeout?: number): void; /** * Run some shared teardown after each of the specs in the describe in which it is called. * @param action Function that contains the code to teardown your specs. * @param timeout Custom timeout for an async afterEach. */ -declare function afterEach(action: (done: DoneFn) => void, timeout?: number): void; +declare function afterEach(action: ImplementationCallback, timeout?: number): void; /** * Run some shared setup once before all of the specs in the describe are run. @@ -69,7 +71,7 @@ declare function afterEach(action: (done: DoneFn) => void, timeout?: number): vo * @param action Function that contains the code to setup your specs. * @param timeout Custom timeout for an async beforeAll. */ -declare function beforeAll(action: (done: DoneFn) => void, timeout?: number): void; +declare function beforeAll(action: ImplementationCallback, timeout?: number): void; /** * Run some shared teardown once before all of the specs in the describe are run. @@ -77,7 +79,7 @@ declare function beforeAll(action: (done: DoneFn) => void, timeout?: number): vo * @param action Function that contains the code to teardown your specs. * @param timeout Custom timeout for an async afterAll */ -declare function afterAll(action: (done: DoneFn) => void, timeout?: number): void; +declare function afterAll(action: ImplementationCallback, timeout?: number): void; /** * Create an expectation for a spec. @@ -268,11 +270,11 @@ declare namespace jasmine { execute(): void; describe(description: string, specDefinitions: () => void): Suite; // ddescribe(description: string, specDefinitions: () => void): Suite; Not a part of jasmine. Angular team adds these - beforeEach(beforeEachFunction: (done: DoneFn) => void, timeout?: number): void; - beforeAll(beforeAllFunction: (done: DoneFn) => void, timeout?: number): void; + beforeEach(beforeEachFunction: ImplementationCallback, timeout?: number): void; + beforeAll(beforeAllFunction: ImplementationCallback, timeout?: number): void; currentRunner(): Runner; - afterEach(afterEachFunction: (done: DoneFn) => void, timeout?: number): void; - afterAll(afterAllFunction: (done: DoneFn) => void, timeout?: number): void; + afterEach(afterEachFunction: ImplementationCallback, timeout?: number): void; + afterAll(afterAllFunction: ImplementationCallback, timeout?: number): void; xdescribe(desc: string, specDefinitions: () => void): XSuite; it(description: string, func: () => void): Spec; // iit(description: string, func: () => void): Spec; Not a part of jasmine. Angular team adds these