-
-
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
Make maxLoops for fake timers configurable #8257
Comments
As a current workaround, it is possible to stack jest.advanceTimersByTime(100000);
jest.advanceTimersByTime(100000); Also, weirdly enough, the number in the code (https://github.com/facebook/jest/blob/master/packages/jest-fake-timers/src/jestFakeTimers.ts#L88) says 100000 but you actually hit the limit at 1000000. |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days. |
Another reason to make this configurable is to speed up debugging in cases where an infinite loop exists. It can take a long time for 100,000 iterations to go by! |
I think taking an options bag to Anybody wanna work on a PR for this? I think Jest 28 is a good time to make such a breaking change to config 🙂 |
Hm.. The original issue is rather puzzling. @mxmzb This is an old issue, of course. Could you to take a look, please? I am working on the implementation of |
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. |
🚀 Feature Proposal
I'd like to be able to configure
maxLoops
(see https://github.com/facebook/jest/blob/master/packages/jest-fake-timers/src/jestFakeTimers.ts#L88) myself when usingjest.useFakeTimers()
Motivation
I am writing a timer app, which actually may count to more than 100.000ms and it would still make sense. Unable to test this though to this limitation.
Pitch
The line already expects an argument which seems to be able to come from somewhere, but the API isn't making this really publically accessible. I don't see a reason why this should not be an optional param in
jest.useFakeTimers()
.The text was updated successfully, but these errors were encountered: