Skip to content

Commit fd95c88

Browse files
committed
docs
1 parent 99a609c commit fd95c88

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

docs/index.md

+14-5
Original file line numberDiff line numberDiff line change
@@ -876,9 +876,7 @@ Use this option to have Mocha check for global variables that are leaked while r
876876
877877
### `--dry-run`
878878

879-
> _New in v9.0.0._
880-
881-
Report tests without executing any of them, neither tests nor hooks.
879+
> _New in v9.0.0._ Report tests without executing any of them, neither tests nor hooks.
882880
883881
### `--exit`
884882

@@ -1015,6 +1013,15 @@ Specify an explicit path to a [configuration file](#configuring-mocha-nodejs).
10151013

10161014
By default, Mocha will search for a config file if `--config` is not specified; use `--no-config` to suppress this behavior.
10171015

1016+
### `--node-option <name>, -n <name>`
1017+
1018+
> _New in v9.1.0._
1019+
1020+
For Node.js and V8 options. Mocha forwards these options to Node.js by spawning a new child-process.<br>
1021+
e.g. `-n require=foo -n unhandled-rejections=strict`
1022+
1023+
Can also be specified as a comma-delimited list: `-n "require=foo, unhandled-rejections=strict"`
1024+
10181025
### `--opts <path>`
10191026

10201027
> _Removed in v8.0.0. Please use [configuration file](#configuring-mocha-nodejs) instead._
@@ -1159,8 +1166,6 @@ Requires either `--grep` or `--fgrep` (but not both).
11591166

11601167
### `--inspect, --inspect-brk, inspect`
11611168

1162-
> _BREAKING CHANGE in v7.0.0; `--debug` / `--debug-brk` are removed and `debug` is deprecated._
1163-
11641169
Enables Node.js' inspector.
11651170

11661171
Use `--inspect` / `--inspect-brk` to launch the V8 inspector for use with Chrome Dev Tools.
@@ -1209,6 +1214,8 @@ These flags vary depending on your version of Node.js.
12091214

12101215
`node` flags can be defined in Mocha's [configuration](#configuring-mocha-nodejs).
12111216

1217+
> _New in v9.1.0._ You can also pass `node` flags to Node.js using [`--node-option`](#-node-option-name-n-name).
1218+
12121219
### `--enable-source-maps`
12131220

12141221
> _New in Node.js v12.12.0_
@@ -1228,6 +1235,8 @@ Prepend `--v8-` to any flag listed in the output of `node --v8-options` (excludi
12281235

12291236
V8 flags can be defined in Mocha's [configuration](#configuring-mocha-nodejs).
12301237

1238+
> _New in v9.1.0._ You can also pass V8 flags (without `--v8-`) to Node.js using [`--node-option`](#-node-option-name-n-name).
1239+
12311240
## Parallel Tests
12321241

12331242
> _New in v.8.0.0._

example/config/.mocharc.js

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = {
2626
'inline-diffs': false,
2727
// invert: false, // needs to be used with grep or fgrep
2828
jobs: 1,
29+
'node-option': ['unhandled-rejections=strict'], // without leading "--", also V8 flags
2930
package: './package.json',
3031
parallel: false,
3132
recursive: false,

example/config/.mocharc.yml

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ inline-diffs: false
2929
# needs to be used with grep or fgrep
3030
# invert: false
3131
jobs: 1
32+
node-option:
33+
- 'unhandled-rejections=strict' # without leading "--", also V8 flags
3234
package: './package.json'
3335
parallel: false
3436
recursive: false

0 commit comments

Comments
 (0)