-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting timers
config property to modern
does not use modern
mode by default in test files
#11370
Comments
Setting Note that in Jest 27 the default is flipped, so wording in |
Oh, interesting. Is there a way to call setSystemTime when you've faked timers via the config? The only way I know how to do it is by chaining the call to useFakeTimers. |
Just calling |
Cool - thanks. I opened #11376 with a documentation update. |
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. |
🐛 Bug Report
My understanding of the
timers
config property (docs) is that setting the value tomodern
should automatically use "modern" mode everytime I calljest.useFakeTimers()
. However, that doesn't appear to be the case.I receive this error when trying to call
modern
-specific methods:To Reproduce
Steps to reproduce the behavior:
timers
injest.config.js
tomodern
jest.useFakeTimers().setSystemTime(0);
in a test file.An error is thrown when running the test file.
Expected behavior
Because I set
timers
tomodern
injest.config.js
, I expected to be able to calljest.useFakeTimers().setSystemTime(0);
becausemodern
should be the default based on my configuration.Link to repl or repo (highly encouraged)
https://replit.com/@blimmer/jest-playground#bug-report.test.js
envinfo
The text was updated successfully, but these errors were encountered: