// Type definitions for jasminewd2 2.0 // Project: https://github.com/angular/jasminewd // Definitions by: Sammy Jelin // George Kalpakas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 /// declare function it(expectation: string, assertion?: (done: DoneFn) => Promise, timeout?: number): void; declare function fit(expectation: string, assertion?: (done: DoneFn) => Promise, timeout?: number): void; declare function xit(expectation: string, assertion?: (done: DoneFn) => Promise, timeout?: number): void; declare function beforeEach(action: (done: DoneFn) => Promise, timeout?: number): void; declare function afterEach(action: (done: DoneFn) => Promise, timeout?: number): void; declare function beforeAll(action: (done: DoneFn) => Promise, timeout?: number): void; declare function afterAll(action: (done: DoneFn) => Promise, timeout?: number): void; declare namespace jasmine { interface Matchers { toBe(expected: any, expectationFailOutput?: any): Promise; toEqual(expected: any, expectationFailOutput?: any): Promise; toMatch(expected: string | RegExp | Promise, expectationFailOutput?: any): Promise; toBeDefined(expectationFailOutput?: any): Promise; toBeUndefined(expectationFailOutput?: any): Promise; toBeNull(expectationFailOutput?: any): Promise; toBeNaN(): Promise; toBeTruthy(expectationFailOutput?: any): Promise; toBeFalsy(expectationFailOutput?: any): Promise; toHaveBeenCalled(): Promise; toHaveBeenCalledWith(...params: any[]): Promise; toHaveBeenCalledTimes(expected: number | Promise): Promise; toContain(expected: any, expectationFailOutput?: any): Promise; toBeLessThan(expected: number | Promise, expectationFailOutput?: any): Promise; toBeLessThanOrEqual(expected: number | Promise, expectationFailOutput?: any): Promise; toBeGreaterThan(expected: number | Promise, expectationFailOutput?: any): Promise; toBeGreaterThanOrEqual(expected: number | Promise, expectationFailOutput?: any): Promise; toBeCloseTo(expected: number | Promise, precision?: any, expectationFailOutput?: any): Promise; toThrow(expected?: any): Promise; toThrowError(message?: string | RegExp | Promise): Promise; toThrowError(expected?: new (...args: any[]) => Error | Promise Error>, message?: string | RegExp | Promise): Promise; } interface ArrayLikeMatchers extends Matchers> { toBe(expected: Expected>, expectationFailOutput?: any): Promise; toEqual(expected: Expected>, expectationFailOutput?: any): Promise; toContain(expected: T, expectationFailOutput?: any): Promise; not: ArrayLikeMatchers; } // Add definition to be compatible with latest jasmine v3 types. // Even though library is not compatible with jasmine v3, there is no suitable way to configure that now here. // See for more detail: https://github.com/microsoft/dtslint/issues/253 interface FunctionMatchers any> extends Matchers { toHaveBeenCalledWith(...params: any[]): boolean; toHaveBeenCalledWith(...params: any[]): Promise; } function addMatchers(matchers: AsyncCustomMatcherFactories): void; interface Spec { addMatchers(matchers: AsyncCustomMatcherFactories): void; } interface AsyncCustomMatcherFactories { [index: string]: AsyncCustomMatcherFactory; } interface AsyncCustomMatcherFactory { (util: MatchersUtil, customEqualityTesters: CustomEqualityTester[]): AsyncCustomMatcher; } interface AsyncCustomMatcher { compare(actual: T, expected: T): AsyncCustomMatcherResult; compare(actual: any, expected: any): AsyncCustomMatcherResult; } interface AsyncCustomMatcherResult { pass: boolean | Promise; message?: string | undefined; } }