Skip to content

Commit

Permalink
docs: added info about modern and legacy timers (#12317)
Browse files Browse the repository at this point in the history
  • Loading branch information
Biki-das authored Feb 7, 2022
1 parent 92f3279 commit 7400207
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/TimerMocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ test('do something with real timers', () => {
});
```

Currently, two implementations of the fake timers are included - `modern` and `legacy`, where `modern` is the default one. See [configuration](Configuration.md#timers-string) for how to configure it.

## Run All Timers

Another test we might want to write for this module is one that asserts that the callback is called after 1 second. To do this, we're going to use Jest's timer control APIs to fast-forward time right in the middle of the test:
Expand Down
2 changes: 2 additions & 0 deletions website/versioned_docs/version-26.x/TimerMocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Here we enable fake timers by calling `jest.useFakeTimers();`. This mocks out se

All of the following functions need fake timers to be set, either by `jest.useFakeTimers()` or via `"timers": "fake"` in the config file.

Currently, two implementations of the fake timers are included - `modern` and `legacy`, where `legacy` is still the default one. See [configuration](Configuration.md#timers-string) for how to configure it.

## Run All Timers

Another test we might want to write for this module is one that asserts that the callback is called after 1 second. To do this, we're going to use Jest's timer control APIs to fast-forward time right in the middle of the test:
Expand Down
2 changes: 2 additions & 0 deletions website/versioned_docs/version-27.0/TimerMocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ test('do something with real timers', () => {

All of the following functions need fake timers to be set, either by `jest.useFakeTimers()` or via `"timers": "fake"` in the config file.

Currently, two implementations of the fake timers are included - `modern` and `legacy`, where `modern` is the default one. See [configuration](Configuration.md#timers-string) for how to configure it.

## Run All Timers

Another test we might want to write for this module is one that asserts that the callback is called after 1 second. To do this, we're going to use Jest's timer control APIs to fast-forward time right in the middle of the test:
Expand Down
2 changes: 2 additions & 0 deletions website/versioned_docs/version-27.1/TimerMocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ test('do something with real timers', () => {

All of the following functions need fake timers to be set, either by `jest.useFakeTimers()` or via `"timers": "fake"` in the config file.

Currently, two implementations of the fake timers are included - `modern` and `legacy`, where `modern` is the default one. See [configuration](Configuration.md#timers-string) for how to configure it.

## Run All Timers

Another test we might want to write for this module is one that asserts that the callback is called after 1 second. To do this, we're going to use Jest's timer control APIs to fast-forward time right in the middle of the test:
Expand Down
2 changes: 2 additions & 0 deletions website/versioned_docs/version-27.2/TimerMocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ test('do something with real timers', () => {

All of the following functions need fake timers to be set, either by `jest.useFakeTimers()` or via `"timers": "fake"` in the config file.

Currently, two implementations of the fake timers are included - `modern` and `legacy`, where `modern` is the default one. See [configuration](Configuration.md#timers-string) for how to configure it.

## Run All Timers

Another test we might want to write for this module is one that asserts that the callback is called after 1 second. To do this, we're going to use Jest's timer control APIs to fast-forward time right in the middle of the test:
Expand Down
2 changes: 2 additions & 0 deletions website/versioned_docs/version-27.4/TimerMocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ test('do something with real timers', () => {

All of the following functions need fake timers to be set, either by `jest.useFakeTimers()` or via `"timers": "fake"` in the config file.

Currently, two implementations of the fake timers are included - `modern` and `legacy`, where `modern` is the default one. See [configuration](Configuration.md#timers-string) for how to configure it.

## Run All Timers

Another test we might want to write for this module is one that asserts that the callback is called after 1 second. To do this, we're going to use Jest's timer control APIs to fast-forward time right in the middle of the test:
Expand Down
2 changes: 2 additions & 0 deletions website/versioned_docs/version-27.5/TimerMocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ test('do something with real timers', () => {
});
```

Currently, two implementations of the fake timers are included - `modern` and `legacy`, where `modern` is the default one. See [configuration](Configuration.md#timers-string) for how to configure it.

## Run All Timers

Another test we might want to write for this module is one that asserts that the callback is called after 1 second. To do this, we're going to use Jest's timer control APIs to fast-forward time right in the middle of the test:
Expand Down

0 comments on commit 7400207

Please sign in to comment.