You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jest has a great mocking for timers with useFakeTimers and advanceTimersByTime. It'd be very useful to have a similar set of utilities for setting the global Date.now() and manually advancing it.
Motivation
Testing Date related logic.
Example
An example of code that could be tested with this feature.
Date related code is a central component of many modern applications. Being able to use the Jest ecosystem to test this code properly would expand the region of code that Jest can mock and test well.
The text was updated successfully, but these errors were encountered:
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
🚀 Feature Proposal
Jest has a great mocking for timers with
useFakeTimers
andadvanceTimersByTime
. It'd be very useful to have a similar set of utilities for setting the globalDate.now()
and manually advancing it.Motivation
Testing
Date
related logic.Example
An example of code that could be tested with this feature.
Pitch
Date
related code is a central component of many modern applications. Being able to use the Jest ecosystem to test this code properly would expand the region of code that Jest can mock and test well.The text was updated successfully, but these errors were encountered: