Skip to content

Commit

Permalink
Add availability note for advanceTimersByTime (#4857)
Browse files Browse the repository at this point in the history
`runTimersToTime` was renamed to `advanceTimersByTime` in 21.3.0. This updates the docs to show the functionality exists in previous versions.
  • Loading branch information
makeshift3ds authored and cpojer committed Nov 8, 2017
1 parent 00114dd commit 084ca1c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions docs/TimerMocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ describe('infiniteTimerGame', () => {
```

## Advance Timers by Time
##### renamed from `runTimersToTime` to `advanceTimersByTime` in Jest **21.3.0**

Another possibility is use `jest.advanceTimersByTime(msToRun)`. When this API is called, all timers are advanced by `msToRun` milliseconds. All pending "macro-tasks" that have been queued via setTimeout() or setInterval(), and would be executed during this timeframe, will be executed. Additionally if those macro-tasks schedule new macro-tasks that would be executed within the same time frame, those will be executed until there are no more macro-tasks remaining in the queue that should be run within msToRun milliseconds.

Expand Down

0 comments on commit 084ca1c

Please sign in to comment.