-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new fakeTimer test and revise the function add advanceTime
- Loading branch information
Lei Chen
authored and
Lei Chen
committed
Sep 8, 2021
1 parent
4a03704
commit b4849bc
Showing
4 changed files
with
81 additions
and
7 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
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,13 @@ | ||
export const jestFakeTimersAreEnabled = () => { | ||
/* istanbul ignore else */ | ||
if (typeof jest !== 'undefined' && jest !== null) { | ||
return ( | ||
// legacy timers | ||
jest.isMockFunction(setTimeout) || | ||
// modern timers | ||
Object.prototype.hasOwnProperty.call(setTimeout, 'clock') | ||
) | ||
} | ||
// istanbul ignore next | ||
return false | ||
} |