When rewriting the tests in Jest, I used a custom stub for setTimeout / clearTimeout instead of using Jest's fake timers. This turned out to be easier to use at the time because of the way that we use setTimeout in PollingBlockTracker. While writing those tests, I ended up adding some custom events that proved to be useful, one of which is _waitingForNextIteration. Now that this exists, I believe that this is the key to using Jest's fake timers.
When rewriting the tests in Jest, I used a custom stub for
setTimeout
/clearTimeout
instead of using Jest's fake timers. This turned out to be easier to use at the time because of the way that we usesetTimeout
in PollingBlockTracker. While writing those tests, I ended up adding some custom events that proved to be useful, one of which is_waitingForNextIteration
. Now that this exists, I believe that this is the key to using Jest's fake timers.