DenoDDeno
Powered by
DanielduelD
Denoβ€’16mo agoβ€’
4 replies
Danielduel

Skipping time in tests; time delay setTimeout setInterval

(the title is just so people can get to this one easier by using search)

I have a deadline/delay based (@std/async) functionality and in tests I want to skip time (so I don't have to pass lower values for timeouts).

I want something like jest's
advanceTimersByTime
advanceTimersByTime

(very bright page warning, usage is at the bottom) https://jestjs.io/docs/timer-mocks
(jest uses sinon's fake timers, sinon uses sinon/fake-timers (install, then createClock, it's basically a big orchiestrated mock on time-based apis))
No idea if sinon works with deno (and if it is the deno's way), I would prefer something jsr/deno for this, any recommendation?
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

WebSocket connections killing setInterval()
pyzaistPpyzaist / help
3y ago
Debug all tests in VSCode
RigadoonRRigadoon / help
3y ago