Closed
Description
🐛 Bug Report
Giving --maxWorkers
a %
instead of a fixed core number does not seem to work.
I looked into it, I found that it seems to expect a number and parsing it sets it to NaN
maxWorkers: NaN,
w: NaN,
'max-workers': NaN,
all: undefined,
bail: undefined,
in jest-cli
it checks the args only for a number
https://github.com/facebook/jest/blob/master/packages/jest-cli/src/cli/args.ts#L345
maxWorkers: {
alias: 'w',
description:
'Specifies the maximum number of workers the worker-pool ' +
'will spawn for running tests. This defaults to the number of the ' +
'cores available on your machine. (its usually best not to override ' +
'this default)',
type: 'number',
},
I quickly tried setting it to a string and it works as expected. I am not sure of all the ramifications of this change but it might be the correct type for it.
To Reproduce
run jest with --maxWorkers=20%
and it will default to 50%
Expected behavior
It should use only 20% of my cpus
Run npx envinfo --preset jest
npx: installed 1 in 1.01s
System:
OS: macOS 10.14.5
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Binaries:
Node: 8.12.0 - /usr/local/opt/node@8/bin/node
Yarn: 1.12.3 - ~/.npm-packages/bin/yarn
npm: 6.9.0 - ~/.npm-packages/bin/npm
npmPackages:
jest: ^24.8.0 => 24.8.0