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: the number of concurrent job with --parallel option in mocha:cli:run:helpers #4416

merged 3 commits into from Oct 12, 2020


Copy link

@sujin-park sujin-park commented Aug 25, 2020


  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • All new code requires tests to ensure against regressions.

Description of the Change

When users run mocha with --parallel option wihtout --jobs option, undefined was passed to the parallelRun method.

I changed to the number of CPU cores less 1 when was false.

스크린샷 2020-08-25 오후 6 09 07

스크린샷 2020-08-25 오후 6 08 37

Alternate Designs

in lib/cli/run-helpers.js from line 179


TO-BE ? : workerpool.cpus - 1

Why should this be in core?

It's a confirmed bug as described in #4415.


Users can know exact current concurrent job count instead NaN.

Possible Drawbacks


Applicable issues


Copy link

@coveralls coveralls commented Aug 25, 2020

Coverage Status

Coverage increased (+0.3%) to 94.078% when pulling e0ae3a5 on sujin-park:sujin-park/fix-parallel into 4d7a171 on mochajs:master.

Copy link

@boneskull boneskull left a comment

Thanks! Just have a small suggestion to simplify things

@@ -175,7 +176,7 @@ const parallelRun = async (mocha, options, fileCollectParams) => {
'executing %d test file(s) across %d concurrent jobs',
files.length, ? : workerpool.cpus - 1

This comment has been minimized.


boneskull Aug 26, 2020

I would just remove the job count. It's printed in the debug logs elsewhere:

'run(): starting worker pool of max size %d, using node args: %s',
process.execArgv.join(' ')

maybe just say executing %d test file(s) in parallel mode

This comment has been minimized.


sujin-park Aug 26, 2020
Author Contributor

I fixed your feedback. I removed params and added text in parallel mode.
Thank you for your comment.

sujin-park added 2 commits Aug 26, 2020
@sujin-park sujin-park requested a review from boneskull Sep 9, 2020
@boneskull boneskull merged commit 31116db into mochajs:master Oct 12, 2020
5 checks passed
5 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed
coverage/coveralls Coverage increased (+0.08%) to 93.867%
licence/cla Contributor License Agreement is signed.
netlify/mocha/deploy-preview Deploy preview ready!
Copy link

@boneskull boneskull commented Oct 12, 2020


@boneskull boneskull added this to the next milestone Oct 12, 2020
@boneskull boneskull modified the milestones: next, v8.2.0 Oct 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.