Skip to content

Commit 6a76384

Browse files
chrisbobbegnprice
authored andcommitted
jest libdef [nfc]: Move some definitions up a bit
The current 26 libdef upstream chooses this location for setSystemTime, and we're about to re-sync with that. (Current upstream doesn't have getRealSystemTime, but it might as well move too.)
1 parent 60bfb01 commit 6a76384

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

flow-typed/jest_v26.x.x.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,26 @@ type JestObjectType = {
806806
* Returns the number of fake timers still left to run.
807807
*/
808808
getTimerCount(): number,
809+
/**
810+
* When mocking time, `Date.now()` will also be mocked. If you for
811+
* some reason need access to the real current time, you can invoke
812+
* this function.
813+
*
814+
* > Note: This function is only available when using modern fake
815+
* > timers implementation
816+
*/
817+
getRealSystemTime(): number,
818+
/**
819+
* Set the current system time used by fake timers. Simulates a
820+
* user changing the system clock while your program is running. It
821+
* affects the current time but it does not in itself cause e.g.
822+
* timers to fire; they will fire exactly as they would have done
823+
* without the call to `jest.setSystemTime()`.
824+
*
825+
* > Note: This function is only available when using modern fake
826+
* > timers implementation
827+
*/
828+
setSystemTime(now?: number | Date): void,
809829
/**
810830
* The same as `mock` but not moved to the top of the expectation by
811831
* babel-jest.
@@ -921,26 +941,6 @@ type JestObjectType = {
921941
* Instructs Jest to use the real versions of the standard timer functions.
922942
*/
923943
useRealTimers(): JestObjectType,
924-
/**
925-
* When mocking time, `Date.now()` will also be mocked. If you for
926-
* some reason need access to the real current time, you can invoke
927-
* this function.
928-
*
929-
* > Note: This function is only available when using modern fake
930-
* > timers implementation
931-
*/
932-
getRealSystemTime(): number,
933-
/**
934-
* Set the current system time used by fake timers. Simulates a
935-
* user changing the system clock while your program is running. It
936-
* affects the current time but it does not in itself cause e.g.
937-
* timers to fire; they will fire exactly as they would have done
938-
* without the call to `jest.setSystemTime()`.
939-
*
940-
* > Note: This function is only available when using modern fake
941-
* > timers implementation
942-
*/
943-
setSystemTime(now?: number | Date): void,
944944
/**
945945
* Creates a mock function similar to jest.fn but also tracks calls to
946946
* object[methodName].

0 commit comments

Comments
 (0)