Skip to content

Commit 9ac2dcd

Browse files
thymikeeSimenB
authored andcommitted
fix: limit number of workers when creating haste maps in projec… (#9259)
1 parent baafcd4 commit 9ac2dcd

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

.vscode/settings.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
"**/node_modules": true,
66
"**/build": true
77
},
8-
"editor.formatOnSave": true,
9-
"flow.useNPMPackagedFlow": true,
8+
"eslint.autoFixOnSave": true,
109
"javascript.validate.enable": false,
11-
"jest.pathToJest": "yarn jest --",
12-
"prettier.eslintIntegration": true
10+
"jest.pathToJest": "yarn jest --"
1311
}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
- `[jest-config]` Fix Jest multi project runner still cannot handle exactly one project ([#8894](https://github.com/facebook/jest/pull/8894))
5050
- `[jest-console]` Add missing `console.group` calls to `NullConsole` ([#9024](https://github.com/facebook/jest/pull/9024))
5151
- `[jest-core]` Don't include unref'd timers in --detectOpenHandles results ([#8941](https://github.com/facebook/jest/pull/8941))
52+
- `[jest-core]` Limit number of workers when creating haste maps in projects ([#9259](https://github.com/facebook/jest/pull/9259))
5253
- `[jest-diff]` Do not inverse format if line consists of one change ([#8903](https://github.com/facebook/jest/pull/8903))
5354
- `[jest-diff]` Rename some new options and change their default values ([#9077](https://github.com/facebook/jest/pull/9077))
5455
- `[jest-fake-timers]` `getTimerCount` will not include cancelled immediates ([#8764](https://github.com/facebook/jest/pull/8764))

packages/jest-core/src/cli/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ const buildContextsAndHasteMaps = async (
122122
createDirectory(config.cacheDirectory);
123123
const hasteMapInstance = Runtime.createHasteMap(config, {
124124
console: new CustomConsole(outputStream, outputStream),
125-
maxWorkers: globalConfig.maxWorkers,
125+
maxWorkers: Math.max(
126+
1,
127+
Math.floor(globalConfig.maxWorkers / configs.length),
128+
),
126129
resetCache: !config.cache,
127130
watch: globalConfig.watch || globalConfig.watchAll,
128131
watchman: globalConfig.watchman,

packages/jest-runtime/src/cli/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export function run(cliArgv?: Config.Argv, cliInfo?: Array<string>) {
3535
.version(false)
3636
.options(args.options).argv;
3737

38-
// @ts-ignore: fix this at some point
3938
validateCLIOptions(argv, {...args.options, deprecationEntries});
4039
}
4140

@@ -63,8 +62,6 @@ export function run(cliArgv?: Config.Argv, cliInfo?: Array<string>) {
6362
const info = cliInfo ? ', ' + cliInfo.join(', ') : '';
6463
console.log(`Using Jest Runtime v${VERSION}${info}`);
6564
}
66-
// TODO: Figure this out
67-
// @ts-ignore: this might not have the correct arguments
6865
const options = readConfig(argv, root);
6966
const globalConfig = options.globalConfig;
7067
// Always disable automocking in scripts.

packages/jest-worker/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ By default, no process is bound to any worker.
8383

8484
The arguments that will be passed to the `setup` method during initialization.
8585

86-
#### `workerPool: (workerPath: string, options?: WorkerPoolOptions) => WorkerPoolInterface` (optional)
86+
#### `WorkerPool: (workerPath: string, options?: WorkerPoolOptions) => WorkerPoolInterface` (optional)
8787

8888
Provide a custom worker pool to be used for spawning child processes. By default, Jest will use a node thread pool if available and fall back to child process threads.
8989

0 commit comments

Comments
 (0)