-
-
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
Add new option "node-option" #4691
Conversation
baf4095
to
fd95c88
Compare
fd95c88
to
1521b78
Compare
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.
👍🏼
|
||
> _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> |
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.
To clear, can we specify name should be without --
nor --v8-
?
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 added the --
info. I prefer to not mention --v8-
as this is a Mocha specific quirk and may be confusing.
@@ -176,6 +176,10 @@ exports.builder = yargs => | |||
group: GROUPS.OUTPUT, | |||
hidden: true | |||
}, | |||
'node-option': { | |||
description: 'Node or V8 option (no leading "--")', |
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.
How about no leading "--" or "--v8-"
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 haven't added the --v8-
part, see comment above.
1521b78
to
ee2203c
Compare
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
,--require
Description 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=strict
or-n require=glob,unhandled-rejections=strict
in addition:
esm
special handling. This package is abandoned and not supported in Mocha v9gc
check and deprecation warning. This V8 option doesn't exist anymore