Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for clock.jump method #2512

Merged
merged 1 commit into from May 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/release-source/release/fake-timers.md
Expand Up @@ -150,6 +150,13 @@ Causes all timers scheduled within the affected time range to be called. `time`

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

#### `clock.jump(time);`

Advance the clock by jumping forward in time, firing callbacks at most once.
`time` takes the same formats as [`clock.tick`](#clockticktime--await-clocktickasynctime).

This can be used to simulate the JS engine (such as a browser) being put to sleep and resumed later, skipping intermediary timers.

#### `clock.next();` / `await clock.nextAsync()`

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