Make maxLoops for fake timers configurable
See original GitHub issue🚀 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 using jest.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().
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Using Fake Timers
When using fake timers, you need to remember to restore the timers after your test runs. The main reason to do that is...
Read more >Timer Mocks
In the following example we enable fake timers by calling jest. ... To do this, we're going to use Jest's timer control APIs...
Read more >Features :: The Sipwise NGCP Handbook - PRO/CARRIER
System-level configuration enables the peer probing feature in general on the Sipwise C5 and determines the operational parameters, such as timeouts, the SIP ......
Read more >Fake timers - Sinon.JS
Fake timers are synchronous implementations of setTimeout and friends that Sinon.JS can overwrite the global functions with to allow you to more easily...
Read more >REACT™ Real-Time Programmer's Guide - irix7.com
IRIX Admin: System Configuration and Operation (007-2859-001) ... Memory-mapping makes I/O programming simple, especially when large numbers.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

As a current workaround, it is possible to stack
jest.advanceTimersByTime(), e.g.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 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.