-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Exposing jest.runToFrame() from sinon/fake_timers #14598
Changes from 7 commits
1b7add7
a43bb16
95a3861
e21c9ca
362c6ed
ec04c81
2dd1cb3
e7e5543
d1ae881
2c69f29
6498b05
bedecdf
172718c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -989,6 +989,16 @@ This function is not available when using legacy fake timers implementation. | |
|
||
::: | ||
|
||
### `jest.runToFrame()` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we call it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just mirrored the sinon api without too much thought 😊
Which do you lean towards? (Or something else?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cc @SimenB There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm? I believe I answered the question? 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, for some reason I didn't see your reply |
||
|
||
Advances all timers by the needed milliseconds to execute the next animation frame. This function is a helpful way to execute code that is scheduled using `requestAnimationFrame`. | ||
|
||
:::info | ||
|
||
This function is not available when using legacy fake timers implementation. | ||
|
||
::: | ||
|
||
### `jest.clearAllTimers()` | ||
|
||
Removes any pending timers from the timer system. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -349,6 +349,14 @@ export interface Jest { | |
* It is recommended to use `jest.mock()` instead. The `jest.mock()` API's second | ||
* argument is a module factory instead of the expected exported module object. | ||
*/ | ||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The above TSDoc belongs to 'setMock'. Would be good to move it down (; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! Fixed |
||
* Advances all timers by the needed milliseconds to execute the next animation frame. | ||
* `runToFrame()` helpful way to execute code that is scheduled using `requestAnimationFrame`. | ||
* | ||
* @remarks | ||
* Not available when using legacy fake timers implementation. | ||
*/ | ||
runToFrame(): void; | ||
setMock(moduleName: string, moduleExports: unknown): Jest; | ||
/** | ||
* Set the current system time used by fake timers. Simulates a user changing | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I add these changes to
29.7
docs or just the base docs like I have now?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just base 👍