Back to Sinon

clock.runAll()

docs/concepts/fake-timers/run-all.md

22.1.0522 B
Original Source

clock.runAll() / await clock.runAllAsync()

This runs all pending timers until there are none remaining. If new timers are added while it is executing they will be run as well.

This makes it easier to run asynchronous tests to completion without worrying about the number of timers they use, or the delays in those timers.

The runAllAsync() will also break the event loop, allowing any scheduled promise callbacks to execute before running the timers.

<<< ../../.vitepress/tests/docs/fake-timers/api-1.test.js