From 91e51917ecac46c86ab7af254b97b57cda81c852 Mon Sep 17 00:00:00 2001 From: Ben Limmer Date: Wed, 5 May 2021 17:39:16 -0600 Subject: [PATCH 1/5] docs: update timers config description Fixes #11370 --- CHANGELOG.md | 1 + docs/Configuration.md | 2 +- website/versioned_docs/version-25.x/Configuration.md | 2 +- website/versioned_docs/version-26.x/Configuration.md | 3 ++- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca4d6e15dc12..6eb083ec04f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) 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. From a57888ce6faf424b78ab8a802e8b456359519147 Mon Sep 17 00:00:00 2001 From: Ben Limmer Date: Thu, 6 May 2021 08:35:55 -0600 Subject: [PATCH 2/5] Update docs/Configuration.md Co-authored-by: Simen Bekkhus --- docs/Configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Configuration.md b/docs/Configuration.md index 9645c394f6e5..b2ba31e0d322 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` 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). +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](JestObjectAPI.md#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). From da4a5c92cc3e01f58facd36a5d37b6338696247c Mon Sep 17 00:00:00 2001 From: Ben Limmer Date: Thu, 6 May 2021 08:36:01 -0600 Subject: [PATCH 3/5] Update website/versioned_docs/version-25.x/Configuration.md Co-authored-by: Simen Bekkhus --- website/versioned_docs/version-25.x/Configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/versioned_docs/version-25.x/Configuration.md b/website/versioned_docs/version-25.x/Configuration.md index 2969b20f40c0..a7ef5374ce1e 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` 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). +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](JestObjectAPI.md#jestusefaketimers). ### `transform` \[object\<string, pathToTransformer | \[pathToTransformer, object]>] From 546ba2b2df049fa63a018dd986568dd36de0953a Mon Sep 17 00:00:00 2001 From: Ben Limmer Date: Thu, 6 May 2021 08:36:10 -0600 Subject: [PATCH 4/5] Update website/versioned_docs/version-26.x/Configuration.md Co-authored-by: Simen Bekkhus --- website/versioned_docs/version-26.x/Configuration.md | 1 - 1 file changed, 1 deletion(-) diff --git a/website/versioned_docs/version-26.x/Configuration.md b/website/versioned_docs/version-26.x/Configuration.md index 2e337be8ffeb..70d4ddde08e4 100644 --- a/website/versioned_docs/version-26.x/Configuration.md +++ b/website/versioned_docs/version-26.x/Configuration.md @@ -1273,7 +1273,6 @@ Default: `real` 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. ### `transform` \[object\<string, pathToTransformer | \[pathToTransformer, object]>] From 7feff7ef06bb02ca91224ad0da4e0a1a104cd714 Mon Sep 17 00:00:00 2001 From: Ben Limmer Date: Thu, 6 May 2021 08:36:18 -0600 Subject: [PATCH 5/5] Update website/versioned_docs/version-26.x/Configuration.md Co-authored-by: Simen Bekkhus --- website/versioned_docs/version-26.x/Configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/versioned_docs/version-26.x/Configuration.md b/website/versioned_docs/version-26.x/Configuration.md index 70d4ddde08e4..eea450fc1ac2 100644 --- a/website/versioned_docs/version-26.x/Configuration.md +++ b/website/versioned_docs/version-26.x/Configuration.md @@ -1271,7 +1271,7 @@ This option sets the URL for the jsdom environment. It is reflected in propertie Default: `real` -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). +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](JestObjectAPI.md#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.