Skip to content

Commit

Permalink
fix: limit number of workers when creating haste maps in projec… (#9259)
Browse files Browse the repository at this point in the history
  • Loading branch information
thymikee authored and SimenB committed Dec 3, 2019
1 parent baafcd4 commit 9ac2dcd
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
6 changes: 2 additions & 4 deletions .vscode/settings.json
Expand Up @@ -5,9 +5,7 @@
"**/node_modules": true,
"**/build": true
},
"editor.formatOnSave": true,
"flow.useNPMPackagedFlow": true,
"eslint.autoFixOnSave": true,
"javascript.validate.enable": false,
"jest.pathToJest": "yarn jest --",
"prettier.eslintIntegration": true
"jest.pathToJest": "yarn jest --"
}
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -49,6 +49,7 @@
- `[jest-config]` Fix Jest multi project runner still cannot handle exactly one project ([#8894](https://github.com/facebook/jest/pull/8894))
- `[jest-console]` Add missing `console.group` calls to `NullConsole` ([#9024](https://github.com/facebook/jest/pull/9024))
- `[jest-core]` Don't include unref'd timers in --detectOpenHandles results ([#8941](https://github.com/facebook/jest/pull/8941))
- `[jest-core]` Limit number of workers when creating haste maps in projects ([#9259](https://github.com/facebook/jest/pull/9259))
- `[jest-diff]` Do not inverse format if line consists of one change ([#8903](https://github.com/facebook/jest/pull/8903))
- `[jest-diff]` Rename some new options and change their default values ([#9077](https://github.com/facebook/jest/pull/9077))
- `[jest-fake-timers]` `getTimerCount` will not include cancelled immediates ([#8764](https://github.com/facebook/jest/pull/8764))
Expand Down
5 changes: 4 additions & 1 deletion packages/jest-core/src/cli/index.ts
Expand Up @@ -122,7 +122,10 @@ const buildContextsAndHasteMaps = async (
createDirectory(config.cacheDirectory);
const hasteMapInstance = Runtime.createHasteMap(config, {
console: new CustomConsole(outputStream, outputStream),
maxWorkers: globalConfig.maxWorkers,
maxWorkers: Math.max(
1,
Math.floor(globalConfig.maxWorkers / configs.length),
),
resetCache: !config.cache,
watch: globalConfig.watch || globalConfig.watchAll,
watchman: globalConfig.watchman,
Expand Down
3 changes: 0 additions & 3 deletions packages/jest-runtime/src/cli/index.ts
Expand Up @@ -35,7 +35,6 @@ export function run(cliArgv?: Config.Argv, cliInfo?: Array<string>) {
.version(false)
.options(args.options).argv;

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

Expand Down Expand Up @@ -63,8 +62,6 @@ export function run(cliArgv?: Config.Argv, cliInfo?: Array<string>) {
const info = cliInfo ? ', ' + cliInfo.join(', ') : '';
console.log(`Using Jest Runtime v${VERSION}${info}`);
}
// TODO: Figure this out
// @ts-ignore: this might not have the correct arguments
const options = readConfig(argv, root);
const globalConfig = options.globalConfig;
// Always disable automocking in scripts.
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-worker/README.md
Expand Up @@ -83,7 +83,7 @@ By default, no process is bound to any worker.

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

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

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.

Expand Down

0 comments on commit 9ac2dcd

Please sign in to comment.