DanielduelD
Deno14mo ago
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

(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?
Was this page helpful?