Skip to content

Commit b2a4df5

Browse files
Add docs for clock.jump method (#2512)
1 parent fb6e695 commit b2a4df5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/release-source/release/fake-timers.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ Causes all timers scheduled within the affected time range to be called. `time`
150150

151151
The `tickAsync()` will also break the event loop, allowing any scheduled promise callbacks to execute _before_ running the timers.
152152

153+
#### `clock.jump(time);`
154+
155+
Advance the clock by jumping forward in time, firing callbacks at most once.
156+
`time` takes the same formats as [`clock.tick`](#clockticktime--await-clocktickasynctime).
157+
158+
This can be used to simulate the JS engine (such as a browser) being put to sleep and resumed later, skipping intermediary timers.
159+
153160
#### `clock.next();` / `await clock.nextAsync()`
154161

155162
Advances the clock to the the moment of the first scheduled timer, firing it.

0 commit comments

Comments
 (0)