forked from angular/jasminewd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(typescript): add types (angular#79)
- Loading branch information
Showing
7 changed files
with
142 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// This is jasminewd's internal version of @types/jasminewd2. If you need types | ||
// for jasminewd2, please use @types/jasminewd2 instead | ||
|
||
// Type definitions for jasminewd2 | ||
// Project https://github.com/angular/jasminewd | ||
// Definitions by: Sammy Jelin <https://github.com/sjelin> | ||
|
||
declare function it(expectation: string, assertion?: () => Promise<void>, timeout?: number): void; | ||
declare function fit(expectation: string, assertion?: () => Promise<void>, timeout?: number): void; | ||
declare function xit(expectation: string, assertion?: () => Promise<void>, timeout?: number): void; | ||
declare function beforeEach(action: () => Promise<void>, timeout?: number): void; | ||
declare function afterEach(action: () => Promise<void>, timeout?: number): void; | ||
declare function beforeAll(action: () => Promise<void>, timeout?: number): void; | ||
declare function afterAll(action: () => Promise<void>, timeout?: number): void; | ||
|
||
declare namespace jasmine { | ||
// The global `Promise` type is too strict and kinda wrong | ||
interface Promise<T> { | ||
then<U>(onFulfill?: (value: T) => U | Promise<U>, onReject?: (error: any) => U | Promise<U>): Promise<U>; | ||
} | ||
|
||
interface Matchers { | ||
toBe(expected: any, expectationFailOutput?: any): Promise<void>; | ||
toEqual(expected: any, expectationFailOutput?: any): Promise<void>; | ||
toMatch(expected: string | RegExp | Promise<string | RegExp>, expectationFailOutput?: any): Promise<void>; | ||
toBeDefined(expectationFailOutput?: any): Promise<void>; | ||
toBeUndefined(expectationFailOutput?: any): Promise<void>; | ||
toBeNull(expectationFailOutput?: any): Promise<void>; | ||
toBeNaN(): Promise<void>; | ||
toBeTruthy(expectationFailOutput?: any): Promise<void>; | ||
toBeFalsy(expectationFailOutput?: any): Promise<void>; | ||
toHaveBeenCalled(): Promise<void>; | ||
toHaveBeenCalledWith(...params: any[]): Promise<void>; | ||
toHaveBeenCalledTimes(expected: number | Promise<number>): Promise<void>; | ||
toContain(expected: any, expectationFailOutput?: any): Promise<void>; | ||
toBeLessThan(expected: number | Promise<number>, expectationFailOutput?: any): Promise<void>; | ||
toBeLessThanOrEqual(expected: number | Promise<number>, expectationFailOutput?: any): Promise<void>; | ||
toBeGreaterThan(expected: number | Promise<number>, expectationFailOutput?: any): Promise<void>; | ||
toBeGreaterThanOrEqual(expected: number | Promise<number>, expectationFailOutput?: any): Promise<void>; | ||
toBeCloseTo(expected: number | Promise<number>, precision?: any, expectationFailOutput?: any): Promise<void>; | ||
toThrow(expected?: any): Promise<void>; | ||
toThrowError(message?: string | RegExp | Promise<string | RegExp>): Promise<void>; | ||
toThrowError(expected?: new (...args: any[]) => Error | Promise<new (...args: any[]) => Error>, message?: string | RegExp | Promise<string | RegExp>): Promise<void>; | ||
} | ||
|
||
function addMatchers(matchers: AsyncCustomMatcherFactories): void; | ||
|
||
interface Env { | ||
addMatchers(matchers: AsyncCustomMatcherFactories): void; | ||
} | ||
|
||
interface Spec { | ||
addMatchers(matchers: AsyncCustomMatcherFactories): void; | ||
} | ||
|
||
interface AsyncCustomMatcherFactories { | ||
[index: string]: AsyncCustomMatcherFactory; | ||
} | ||
|
||
interface AsyncCustomMatcherFactory { | ||
(util: MatchersUtil, customEqualityTesters: Array<CustomEqualityTester>): AsyncCustomMatcher; | ||
} | ||
|
||
interface AsyncCustomMatcher { | ||
compare<T>(actual: T, expected: T): AsyncCustomMatcherResult; | ||
compare(actual: any, expected: any): AsyncCustomMatcherResult; | ||
} | ||
|
||
interface AsyncCustomMatcherResult { | ||
pass: boolean | Promise<boolean>; | ||
message?: string; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters