-
-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(jest): fix type collisions between jasmine/jest
- Loading branch information
Showing
5 changed files
with
77 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
declare namespace jest { | ||
interface Matchers<R> { | ||
toExist(): boolean; | ||
|
||
toHaveLength(expected: number): boolean; | ||
|
||
toHaveId(id: string | number): boolean; | ||
|
||
toHaveClass(className: string): boolean; | ||
/** | ||
* @deprecated | ||
*/ | ||
toHaveAttr({ attr, val }: { attr: string; val: string }): boolean; | ||
toHaveAttribute(attr: string, val: string): boolean; | ||
/** | ||
* @deprecated | ||
*/ | ||
toHaveProp({ prop, val }: { prop: string; val: string }): boolean; | ||
toHaveProperty(prop: string, val: string | boolean): boolean; | ||
|
||
toHaveProperty(prop: string, val: string | boolean): boolean; | ||
|
||
toHaveText(text: string | Function): boolean; | ||
|
||
toHaveValue(value: string): boolean; | ||
|
||
toHaveStyle(style: { [styleKey: string]: any }): boolean; | ||
|
||
toHaveData({ data, val }: { data: string; val: string }): boolean; | ||
|
||
toBeChecked(): boolean; | ||
|
||
toBeDisabled(): boolean; | ||
|
||
toBeEmpty(): boolean; | ||
|
||
toBeHidden(): boolean; | ||
|
||
toBeSelected(): boolean; | ||
|
||
toBeVisible(): boolean; | ||
|
||
toBeFocused(): boolean; | ||
|
||
toBeMatchedBy(selector: string | Element): boolean; | ||
|
||
toHaveDescendant(selector: string | Element): boolean; | ||
|
||
toHaveDescendantWithText({ selector, text }: { selector: string; text: string }): boolean; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* This file was creating to avoid conflicts during building between jasmine and jest. | ||
* | ||
* Projects using @netbasal/spectator should just use either @types/jasmine or @types/jest. | ||
*/ | ||
|
||
declare namespace jest { | ||
interface Mock<T = {}> extends Function, MockInstance<T> { | ||
new (...args: any[]): T; | ||
|
||
(...args: any[]): any; | ||
} | ||
|
||
function fn<T>(implementation?: (...args: any[]) => any): Mock<T>; | ||
|
||
interface MockInstance<T> { | ||
mockImplementation(fn?: (...args: any[]) => any): Mock<T>; | ||
|
||
mockReturnValue(value: any): Mock<T>; | ||
|
||
mockReset(): void; | ||
} | ||
} |