From 10429b62eed5771e3a3051e79ac9649023edf246 Mon Sep 17 00:00:00 2001 From: Ben Limmer Date: Wed, 5 May 2021 17:39:16 -0600 Subject: [PATCH] docs: update timers config description Fixes #11370 --- docs/Configuration.md | 2 +- website/versioned_docs/version-25.x/Configuration.md | 2 +- website/versioned_docs/version-26.x/Configuration.md | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/Configuration.md b/docs/Configuration.md index ed58e7ba9cad..9645c394f6e5 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -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). 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). diff --git a/website/versioned_docs/version-25.x/Configuration.md b/website/versioned_docs/version-25.x/Configuration.md index 13fc520c28b0..2969b20f40c0 100644 --- a/website/versioned_docs/version-25.x/Configuration.md +++ b/website/versioned_docs/version-25.x/Configuration.md @@ -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). ### `transform` \[object\<string, pathToTransformer | \[pathToTransformer, object]>] diff --git a/website/versioned_docs/version-26.x/Configuration.md b/website/versioned_docs/version-26.x/Configuration.md index 614120470081..2e337be8ffeb 100644 --- a/website/versioned_docs/version-26.x/Configuration.md +++ b/website/versioned_docs/version-26.x/Configuration.md @@ -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). + 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.