Schedule a function to be run the next time the clock is advanced by any ammount.
Schedule a function to be run when the clock advances each multiple
of n
past the current point.
If multiple steps are advanced at once, for example doing
c.setInterval(fn, 1) ; c.advance(1000)
, then it will only call the
function once. This allows you to simulate clock jitter.
Only ms granularity.
Schedule a function to be run when the clock has advanced n
ms beyond
the current point.
Only ms granularity.
Clear an immediate timer created by the clock. (alias for Clock#clearTimeout)
Clear an interval created by the clock. (alias for Clock#clearTimeout)
Clear a timeout created by the clock.
The promisified setImmediate, also available via
promisify(clock.setImmediate)
Optional
value: undefinedOptional
options: { Optional
reffed?: booleanOptional
signal?: AbortSignalOptional
options: { Optional
reffed?: booleanOptional
signal?: AbortSignalpromisified setInterval
, also available via
promisify(clock.setImmediate)
Optional
n: numberOptional
value: undefinedOptional
options: { Optional
reffed?: booleanOptional
signal?: AbortSignalOptional
n: numberOptional
value: TOptional
options: { Optional
reffed?: booleanOptional
signal?: AbortSignalThe promisified setTimeout, also available via
promisify(clock.setTimeout)
Optional
n: numberOptional
value: undefinedOptional
options: { Optional
reffed?: booleanOptional
signal?: AbortSignalOptional
options: { Optional
reffed?: booleanOptional
signal?: AbortSignal
The mock clock implementation