Skip to content

Commit baf4095

Browse files
committed
docs [ci skip]
1 parent 96e196a commit baf4095

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

docs/index.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,15 @@ Specify an explicit path to a [configuration file](#configuring-mocha-nodejs).
10151015

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

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

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

11601169
### `--inspect, --inspect-brk, inspect`
11611170

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

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

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

1219+
> _New in v9.1.0._
1220+
1221+
You can also pass `node` flags to Node.js using [`--node-option`](#-node-option-name-n-name).
1222+
12121223
### `--enable-source-maps`
12131224

12141225
> _New in Node.js v12.12.0_
@@ -1228,6 +1239,10 @@ Prepend `--v8-` to any flag listed in the output of `node --v8-options` (excludi
12281239

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

1242+
> _New in v9.1.0._
1243+
1244+
You can also pass V8 flags (without `--v8-`) to Node.js using [`--node-option`](#-node-option-name-n-name).
1245+
12311246
## Parallel Tests
12321247

12331248
> _New in v.8.0.0._

example/config/.mocharc.js

Lines changed: 1 addition & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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)