Repository navigation
Add new option "node-option" - #4691
Merged
Merged
Conversation
juergba
force-pushed
the
juergba/node-option
branch
2 times, most recently
from
July 25, 2021 11:49
baf4095 to
fd95c88
Compare
juergba
marked this pull request as ready for review
July 25, 2021 12:15
juergba
force-pushed
the
juergba/node-option
branch
from
July 27, 2021 15:57
fd95c88 to
1521b78
Compare
outsideris
approved these changes
Jul 28, 2021
|
|
||
| > _New in v9.1.0._ | ||
|
|
||
| For Node.js and V8 options. Mocha forwards these options to Node.js by spawning a new child-process.<br> |
Contributor
There was a problem hiding this comment.
To clear, can we specify name should be without -- nor --v8-?
Contributor
Author
There was a problem hiding this comment.
I added the -- info. I prefer to not mention --v8- as this is a Mocha specific quirk and may be confusing.
| hidden: true | ||
| }, | ||
| 'node-option': { | ||
| description: 'Node or V8 option (no leading "--")', |
Contributor
There was a problem hiding this comment.
How about no leading "--" or "--v8-"
Contributor
Author
There was a problem hiding this comment.
I haven't added the --v8- part, see comment above.
juergba
force-pushed
the
juergba/node-option
branch
from
July 30, 2021 12:48
1521b78 to
ee2203c
Compare
4 tasks done
lennonnikolas
pushed a commit
to lennonnikolas/mocha
that referenced
this pull request
Jan 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Currently Mocha is parsing its own options, plus Node and V8 options as well. Mocha has to recognize those foreign options in order to pass them to a newly spawned child-process.
Mocha's options are defined in yargs/yargs-parser, whereas Node/V8 options:
process.allowedNodeEnvironmentFlags, which contains most but not all flags.v8[_-]has to be prepended.This Mocha/Node hybrid parsing has some disadvantages:
--prof,--requireDescription of the Change
Mocha should not have to check/process any Node/V8 flags, but simply parse and hand them over to Node.
So we add a new flag
--node-option/-n:-n require=glob -n unhandled-rejections=strictor-n require=glob,unhandled-rejections=strictin addition:
esmspecial handling. This package is abandoned and not supported in Mocha v9gccheck and deprecation warning. This V8 option doesn't exist anymore