From 5bf72ec9e57d5db5bbf9c0c53873c77c1e544039 Mon Sep 17 00:00:00 2001 From: Ahn Date: Thu, 8 Apr 2021 10:14:42 +0200 Subject: [PATCH] docs(configuration): add `maxWorkers` option documentation (#11276) --- docs/Configuration.md | 6 ++++++ website/versioned_docs/version-25.x/Configuration.md | 6 ++++++ website/versioned_docs/version-26.x/Configuration.md | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/docs/Configuration.md b/docs/Configuration.md index 618d62df9608..320f26fbd89e 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -536,6 +536,12 @@ Default: `5` A number limiting the number of tests that are allowed to run at the same time when using `test.concurrent`. Any test above this limit will be queued and executed once a slot is released. +### `maxWorkers` \[number | string] + +Specifies the maximum number of workers the worker-pool will spawn for running tests. In single run mode, this defaults to the number of the cores available on your machine minus one for the main thread. In watch mode, this defaults to half of the available cores on your machine to ensure Jest is unobtrusive and does not grind your machine to a halt. It may be useful to adjust this in resource limited environments like CIs but the defaults should be adequate for most use-cases. + +For environments with variable CPUs available, you can use percentage based configuration: `"maxWorkers": "50%"` + ### `moduleDirectories` \[array<string>] Default: `["node_modules"]` diff --git a/website/versioned_docs/version-25.x/Configuration.md b/website/versioned_docs/version-25.x/Configuration.md index cb77f8d8555c..521d0d9fc4bd 100644 --- a/website/versioned_docs/version-25.x/Configuration.md +++ b/website/versioned_docs/version-25.x/Configuration.md @@ -475,6 +475,12 @@ Default: `5` A number limiting the number of tests that are allowed to run at the same time when using `test.concurrent`. Any test above this limit will be queued and executed once a slot is released. +### `maxWorkers` \[number | string] + +Specifies the maximum number of workers the worker-pool will spawn for running tests. In single run mode, this defaults to the number of the cores available on your machine minus one for the main thread. In watch mode, this defaults to half of the available cores on your machine to ensure Jest is unobtrusive and does not grind your machine to a halt. It may be useful to adjust this in resource limited environments like CIs but the defaults should be adequate for most use-cases. + +For environments with variable CPUs available, you can use percentage based configuration: `"maxWorkers": "50%"` + ### `moduleDirectories` \[array<string>] Default: `["node_modules"]` diff --git a/website/versioned_docs/version-26.x/Configuration.md b/website/versioned_docs/version-26.x/Configuration.md index 8b9eb32a27a8..7ccb93d90f1e 100644 --- a/website/versioned_docs/version-26.x/Configuration.md +++ b/website/versioned_docs/version-26.x/Configuration.md @@ -511,6 +511,12 @@ Default: `5` A number limiting the number of tests that are allowed to run at the same time when using `test.concurrent`. Any test above this limit will be queued and executed once a slot is released. +### `maxWorkers` \[number | string] + +Specifies the maximum number of workers the worker-pool will spawn for running tests. In single run mode, this defaults to the number of the cores available on your machine minus one for the main thread. In watch mode, this defaults to half of the available cores on your machine to ensure Jest is unobtrusive and does not grind your machine to a halt. It may be useful to adjust this in resource limited environments like CIs but the defaults should be adequate for most use-cases. + +For environments with variable CPUs available, you can use percentage based configuration: `"maxWorkers": "50%"` + ### `moduleDirectories` \[array<string>] Default: `["node_modules"]`