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: update timers config description #11376

Merged
merged 5 commits into from May 6, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -109,6 +109,7 @@
- `[*]` [**BREAKING**] Remove deprecated `mapCoverage` ([#9968](https://github.com/facebook/jest/pull/9968))
- `[babel-jest]` [**BREAKING**] Migrate to ESM ([#11193](https://github.com/facebook/jest/pull/11193))
- `[docs]` Correct example using `browser-resolve` ([#11140](https://github.com/facebook/jest/pull/11140))
- `[docs]` Clarify `timers` configuration property ([#11376](https://github.com/facebook/jest/pull/11376))
- `[jest-config]` [**BREAKING**] Remove `enabledTestsMap` config, use `filter` instead ([#10787](https://github.com/facebook/jest/pull/10787))
- `[jest-console]` [**BREAKING**] Move `root` into `config` and take `GlobalConfig` as mandatory parameter for `getConsoleOutput` ([#10126](https://github.com/facebook/jest/pull/10126))
- `[jest-console]` Export LogEntry ([#11017](https://github.com/facebook/jest/pull/11017))
Expand Down
2 changes: 1 addition & 1 deletion docs/Configuration.md
Expand Up @@ -1296,7 +1296,7 @@ This option sets the URL for the jsdom environment. It is reflected in propertie

Default: `real`

Setting this value to `fake` or `modern` allows the use of fake timers for functions such as `setTimeout`. Fake timers are useful when a piece of code sets a long timeout that we don't want to wait for in a test.
Setting this value to `fake` or `modern` enables fake timers for all tests by default. Fake timers are useful when a piece of code sets a long timeout that we don't want to wait for in a test. You can learn more about fake timers [here](https://jestjs.io/docs/jest-object#jestusefaketimersimplementation-modern--legacy).
blimmer marked this conversation as resolved.
Show resolved Hide resolved

If the value is `legacy`, the old implementation will be used as implementation instead of one backed by [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers).

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-25.x/Configuration.md
Expand Up @@ -1181,7 +1181,7 @@ This option sets the URL for the jsdom environment. It is reflected in propertie

Default: `real`

Setting this value to `legacy` or `fake` allows the use of fake timers for functions such as `setTimeout`. Fake timers are useful when a piece of code sets a long timeout that we don't want to wait for in a test.
Setting this value to `legacy` or `fake` enables fake timers for all tests by default. Fake timers are useful when a piece of code sets a long timeout that we don't want to wait for in a test. You can learn more about fake timers [here](https://jestjs.io/docs/25.x/jest-object#jestusefaketimers).
blimmer marked this conversation as resolved.
Show resolved Hide resolved

### `transform` \[object\<string, pathToTransformer | \[pathToTransformer, object]>]

Expand Down
3 changes: 2 additions & 1 deletion website/versioned_docs/version-26.x/Configuration.md
Expand Up @@ -1271,7 +1271,8 @@ This option sets the URL for the jsdom environment. It is reflected in propertie

Default: `real`

Setting this value to `legacy` or `fake` allows the use of fake timers for functions such as `setTimeout`. Fake timers are useful when a piece of code sets a long timeout that we don't want to wait for in a test.
Setting this value to `legacy` or `modern` enables fake timers for all tests by default. Fake timers are useful when a piece of code sets a long timeout that we don't want to wait for in a test. You can learn more about fake timers [here](https://jestjs.io/docs/26.x/jest-object#jestusefaketimersimplementation-modern--legacy).
blimmer marked this conversation as resolved.
Show resolved Hide resolved

blimmer marked this conversation as resolved.
Show resolved Hide resolved

If the value is `modern`, [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers) will be used as implementation instead of Jest's own legacy implementation. This will be the default fake implementation in Jest 27.

Expand Down