-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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: the number of concurrent job with --parallel option in mocha:cli:run:helpers #4416
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just have a small suggestion to simplify things
lib/cli/run-helpers.js
Outdated
@@ -175,7 +176,7 @@ const parallelRun = async (mocha, options, fileCollectParams) => { | |||
debug( | |||
'executing %d test file(s) across %d concurrent jobs', | |||
files.length, | |||
options.jobs | |||
options.jobs ? options.jobs : workerpool.cpus - 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just remove the job count. It's printed in the debug logs elsewhere:
mocha/lib/nodejs/buffered-worker-pool.js
Lines 72 to 76 in e677219
debug( | |
'run(): starting worker pool of max size %d, using node args: %s', | |
maxWorkers, | |
process.execArgv.join(' ') | |
); |
maybe just say executing %d test file(s) in parallel mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed your feedback. I removed options.jobs params and added text in parallel mode
.
Thank you for your comment.
thanks! |
Requirements
Description of the Change
When users run mocha with
--parallel
option wihtout--jobs
option,undefined
was passed to the parallelRun method.I changed options.jobs to the number of CPU cores less 1 when options.jobs was false.
AS-IS
TO-BE
Alternate Designs
in
lib/cli/run-helpers.js
from line179
AS-iS
TO-BE
Why should this be in core?
It's a confirmed bug as described in #4415.
Benefits
Users can know exact current concurrent job count instead NaN.
Possible Drawbacks
N/A
Applicable issues
#4415