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

docs: added info about modern and legacy timers #12317

Merged
merged 9 commits into from Feb 7, 2022
2 changes: 2 additions & 0 deletions docs/TimerMocks.md
Expand Up @@ -53,6 +53,8 @@ test('do something with real timers', () => {
});
```

Currently, two implementations of the fake timers are present - `modern` and `legacy`, where `modern` is still the default one. You can read how to enable `modern` implementation [here](/blog/2020/05/05/jest-26#new-fake-timers).
Biki-das marked this conversation as resolved.
Show resolved Hide resolved

## 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
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 present - `modern` and `legacy`, where `legacy` is still the default one. You can read how to enable `legacy` implementation [here](/blog/2020/05/05/jest-26#new-fake-timers).
Biki-das marked this conversation as resolved.
Show resolved Hide resolved

## 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
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 present - `modern` and `legacy`, where `modern` is still the default one. You can read how to enable `modern` implementation [here](/blog/2020/05/05/jest-26#new-fake-timers).
Biki-das marked this conversation as resolved.
Show resolved Hide resolved

## 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
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 present - `modern` and `legacy`, where `modern` is still the default one. You can read how to enable `modern` implementation [here](/blog/2020/05/05/jest-26#new-fake-timers).
Biki-das marked this conversation as resolved.
Show resolved Hide resolved

## 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
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 present - `modern` and `legacy`, where `modern` is still the default one. You can read how to enable `modern` implementation [here](/blog/2020/05/05/jest-26#new-fake-timers).
Biki-das marked this conversation as resolved.
Show resolved Hide resolved

## 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
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 present - `modern` and `legacy`, where `modern` is still the default one. You can read how to enable `modern` implementation [here](/blog/2020/05/05/jest-26#new-fake-timers).
Biki-das marked this conversation as resolved.
Show resolved Hide resolved

## 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
Expand Up @@ -53,6 +53,8 @@ test('do something with real timers', () => {
});
```

Currently, two implementations of the fake timers are present - `modern` and `legacy`, where `modern` is still the default one. You can read how to enable `modern` implementation [here](/blog/2020/05/05/jest-26#new-fake-timers).
Biki-das marked this conversation as resolved.
Show resolved Hide resolved

## 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