Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: limit number of workers when creating haste maps in projects #9259

Merged
merged 4 commits into from Dec 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions .vscode/settings.json
Expand Up @@ -5,9 +5,7 @@
"**/node_modules": true,
"**/build": true
},
"editor.formatOnSave": true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure? 😀

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Format on save may conflict with eslint fix, if editor settings for prettier differ

Copy link
Member

@SimenB SimenB Dec 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems silly to me to have editor specific config files checked in, but I'm not losing sleep over it 🤷‍♂

"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(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's not meaningful test we can write, right?

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)
thymikee marked this conversation as resolved.
Show resolved Hide resolved
#### `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