You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/index.md
+14-9
Original file line number
Diff line number
Diff line change
@@ -876,7 +876,7 @@ Use this option to have Mocha check for global variables that are leaked while r
876
876
877
877
### `--dry-run`
878
878
879
-
> _New in v9.0.0._ 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.
880
880
881
881
### `--exit`
882
882
@@ -899,6 +899,10 @@ To ensure your tests aren't leaving messes around, here are some ideas to get st
899
899
- Try something like [wtfnode][npm-wtfnode]
900
900
- Use [`.only`](#exclusive-tests) until you find the test that causes Mocha to hang
901
901
902
+
### `--fail-zero`
903
+
904
+
> _New in v9.1.0_ Fail test run if no tests are encountered with `exit-code: 1`.
905
+
902
906
### `--forbid-only`
903
907
904
908
Enforce a rule that tests may not be exclusive (use of e.g., `describe.only()` or `it.only()` is disallowed).
@@ -1007,15 +1011,15 @@ Can be specified as a comma-delimited list.
1007
1011
1008
1012
### `--config <path>`
1009
1013
1010
-
> _New in v6.0.0._
1014
+
> _New in v6.0.0_
1011
1015
1012
1016
Specify an explicit path to a [configuration file](#configuring-mocha-nodejs).
1013
1017
1014
1018
By default, Mocha will search for a config file if `--config` is not specified; use `--no-config` to suppress this behavior.
1015
1019
1016
1020
### `--node-option <name>, -n <name>`
1017
1021
1018
-
> _New in v9.1.0._
1022
+
> _New in v9.1.0_
1019
1023
1020
1024
For Node.js and V8 options. Mocha forwards these options to Node.js by spawning a new child-process.<br>
1021
1025
The options are set without leading dashes `--`, e.g. `-n require=foo -n unhandled-rejections=strict`
@@ -1028,7 +1032,7 @@ Can also be specified as a comma-delimited list: `-n require=foo,unhandled-rejec
1028
1032
1029
1033
### `--package <path>`
1030
1034
1031
-
> _New in v6.0.0._
1035
+
> _New in v6.0.0_
1032
1036
1033
1037
Specify an explicit path to a [`package.json` file](#configuring-mocha-nodejs) (ostensibly containing configuration in a `mocha` property).
1034
1038
@@ -1042,7 +1046,7 @@ Specifying `--extension` will _remove_ `.js` as a test file extension; use `--ex
1042
1046
1043
1047
The option can be given multiple times. The option accepts a comma-delimited list: `--extension a,b` is equivalent to `--extension a --extension b`.
1044
1048
1045
-
> _New in v8.2.0._
1049
+
> _New in v8.2.0_
1046
1050
1047
1051
`--extension` now supports multipart extensions (e.g., `spec.js`), leading dots (`.js`) and combinations thereof (`.spec.js`);
1048
1052
@@ -1217,7 +1221,7 @@ These flags vary depending on your version of Node.js.
1217
1221
1218
1222
`node` flags can be defined in Mocha's [configuration](#configuring-mocha-nodejs).
1219
1223
1220
-
> _New in v9.1.0._ You can also pass `node` flags to Node.js using [`--node-option`](#-node-option-name-n-name).
1224
+
> _New in v9.1.0_ You can also pass `node` flags to Node.js using [`--node-option`](#-node-option-name-n-name).
1221
1225
1222
1226
### `--enable-source-maps`
1223
1227
@@ -1238,7 +1242,7 @@ Prepend `--v8-` to any flag listed in the output of `node --v8-options` (excludi
1238
1242
1239
1243
V8 flags can be defined in Mocha's [configuration](#configuring-mocha-nodejs).
1240
1244
1241
-
> _New in v9.1.0._ You can also pass V8 flags (without `--v8-`) to Node.js using [`--node-option`](#-node-option-name-n-name).
1245
+
> _New in v9.1.0_ You can also pass V8 flags (without `--v8-`) to Node.js using [`--node-option`](#-node-option-name-n-name).
1242
1246
1243
1247
## Parallel Tests
1244
1248
@@ -1369,7 +1373,7 @@ It's unlikely (but not impossible) to see a performance gain from a [job count](
1369
1373
1370
1374
## Root Hook Plugins
1371
1375
1372
-
> _New in v8.0.0._
1376
+
> _New in v8.0.0_
1373
1377
1374
1378
In some cases, you may want a [hook](#hooks) before (or after) every test in every file. These are called _root hooks_. Previous to v8.0.0, the way to accomplish this was to use `--file` combined with root hooks (see [example above](#root-hooks-are-not-global)). This still works in v8.0.0, but _not_ when running tests in parallel mode! For that reason, running root hooks using this method is _strongly discouraged_, and may be deprecated in the future.
1375
1379
@@ -1593,7 +1597,7 @@ If you're a library maintainer, and your library uses root hooks, you can migrat
1593
1597
1594
1598
## Global Fixtures
1595
1599
1596
-
> New in v8.2.0
1600
+
> _New in v8.2.0_
1597
1601
1598
1602
At first glance, _global fixtures_ seem similar to [root hooks](#root-hook-plugins). However, unlike root hooks, global fixtures:
0 commit comments