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 1 commit
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 --"
}
2 changes: 1 addition & 1 deletion packages/jest-core/src/cli/index.ts
Expand Up @@ -122,7 +122,7 @@ const buildContextsAndHasteMaps = async (
createDirectory(config.cacheDirectory);
const hasteMapInstance = Runtime.createHasteMap(config, {
console: new CustomConsole(outputStream, outputStream),
maxWorkers: globalConfig.maxWorkers,
maxWorkers: Math.max(1, 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
6 changes: 0 additions & 6 deletions packages/jest-worker/README.md
Expand Up @@ -83,12 +83,6 @@ 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

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.

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

#### `enableWorkerThreads: boolean` (optional)

`jest-worker` will automatically detect if `worker_threads` are available, but will not use them unless passed `enableWorkerThreads: true`.
Expand Down