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
docs: replace "New in" with "Since" in version annotations (#5262)
* docs: replace "New in" with "Since" in version annotations
* Change version annotations from "New in vX.Y.Z" to "Since vX.Y.Z"
* Align with Node.js documentation style convention
* Improve clarity for users upgrading from older versions
Closes#5166
* Update docs/index.md
Co-authored-by: Josh Goldberg ✨ <[email protected]>
* fix typo
---------
Co-authored-by: Josh Goldberg ✨ <[email protected]>
Copy file name to clipboardexpand all lines: docs/index.md
+23-23
Original file line number
Diff line number
Diff line change
@@ -903,7 +903,7 @@ Use this option to have Mocha check for global variables that are leaked while r
903
903
904
904
### `--dry-run`
905
905
906
-
> _New in v9.0.0_ Report tests without executing any of them, neither tests nor hooks.
906
+
> _Since v9.0.0_ Report tests without executing any of them, neither tests nor hooks.
907
907
908
908
### `--exit`
909
909
@@ -928,13 +928,13 @@ To ensure your tests aren't leaving messes around, here are some ideas to get st
928
928
929
929
### `--pass-on-failing-test-suite`
930
930
931
-
> _New in v10.7.0_
931
+
> _Since v10.7.0_
932
932
933
933
If set to `true`, Mocha returns exit code `0` even if there are failed tests during run.
934
934
935
935
### `--fail-zero`
936
936
937
-
> _New in v9.1.0_
937
+
> _Since v9.1.0_
938
938
939
939
Fail test run if no tests are encountered with `exit-code: 1`.
940
940
@@ -1008,7 +1008,7 @@ Some assertion libraries will supply their own diffs, in which case Mocha's will
1008
1008
1009
1009
Mocha's own diff output does not conform to any known standards, and is designed to be human-readable.
1010
1010
1011
-
> _New in v9.2.1_
1011
+
> _Since v9.2.1_
1012
1012
1013
1013
By default strings are truncated to 8192 characters before generating a diff. This is to prevent performance problems with large strings.
1014
1014
@@ -1048,15 +1048,15 @@ Can be specified as a comma-delimited list.
1048
1048
1049
1049
### `--config <path>`
1050
1050
1051
-
> _New in v6.0.0_
1051
+
> _Since v6.0.0_
1052
1052
1053
1053
Specify an explicit path to a [configuration file](#configuring-mocha-nodejs).
1054
1054
1055
1055
By default, Mocha will search for a config file if `--config` is not specified; use `--no-config` to suppress this behavior.
1056
1056
1057
1057
### `--node-option <name>, -n <name>`
1058
1058
1059
-
> _New in v9.1.0_
1059
+
> _Since v9.1.0_
1060
1060
1061
1061
For Node.js and V8 options. Mocha forwards these options to Node.js by spawning a new child-process.<br>
1062
1062
The options are set without leading dashes `--`, e.g. `-n require=foo -n unhandled-rejections=strict`
@@ -1069,7 +1069,7 @@ Can also be specified as a comma-delimited list: `-n require=foo,unhandled-rejec
1069
1069
1070
1070
### `--package <path>`
1071
1071
1072
-
> _New in v6.0.0_
1072
+
> _Since v6.0.0_
1073
1073
1074
1074
Specify an explicit path to a [`package.json` file](#configuring-mocha-nodejs) (ostensibly containing configuration in a `mocha` property).
1075
1075
@@ -1083,7 +1083,7 @@ Specifying `--extension` will _remove_ `.js` as a test file extension; use `--ex
1083
1083
1084
1084
The option can be given multiple times. The option accepts a comma-delimited list: `--extension a,b` is equivalent to `--extension a --extension b`.
1085
1085
1086
-
> _New in v8.2.0_
1086
+
> _Since v8.2.0_
1087
1087
1088
1088
`--extension` now supports multipart extensions (e.g., `spec.js`), leading dots (`.js`) and combinations thereof (`.spec.js`);
1089
1089
@@ -1104,7 +1104,7 @@ Files specified in this way should contain one or more suites, tests or hooks. I
1104
1104
Explicitly ignore one or more test files, directories or globs (e.g., `some/**/files*`) that would otherwise be loaded.<br>
1105
1105
Can be specified multiple times.
1106
1106
1107
-
> _New in v10.0.0:_ In Windows always use forward-slashes `/` as path separator.
1107
+
> _Since v10.0.0:_ In Windows always use forward-slashes `/` as path separator.
1108
1108
1109
1109
Files specified using `--file`_are not affected_ by this option.
1110
1110
@@ -1144,7 +1144,7 @@ Tests may be rerun manually by typing ⓡ ⓢ ⏎ (same shortcut
1144
1144
1145
1145
### `--watch-files <file|directory|glob>`
1146
1146
1147
-
> _New in v7.0.0_
1147
+
> _Since v7.0.0_
1148
1148
1149
1149
List of paths or globs to watch when `--watch` is set. If a file matching the given glob changes or is added or removed mocha will rerun all tests.
1150
1150
@@ -1156,7 +1156,7 @@ The option can be given multiple times. The option accepts a comma-delimited lis
1156
1156
1157
1157
### `--watch-ignore <file|directory|glob>`
1158
1158
1159
-
> _New in v7.0.0_
1159
+
> _Since v7.0.0_
1160
1160
1161
1161
List of paths or globs to exclude from watching. Defaults to `node_modules` and `.git`.
1162
1162
@@ -1223,7 +1223,7 @@ Implies `--timeout 0`.
1223
1223
1224
1224
### `--parallel, -p`
1225
1225
1226
-
> _New in v.8.0.0._
1226
+
> _Since v.8.0.0._
1227
1227
1228
1228
Use the `--parallel` flag to run tests in a worker pool.
1229
1229
@@ -1233,7 +1233,7 @@ Each test file will be put into a queue and executed as workers become available
1233
1233
1234
1234
### `--jobs <count>, -j <count>`
1235
1235
1236
-
> _New in v.8.0.0._
1236
+
> _Since v.8.0.0._
1237
1237
1238
1238
Use `--jobs <count>` to specify the _maximum_ number of processes in the worker pool.
1239
1239
@@ -1259,11 +1259,11 @@ These flags vary depending on your version of Node.js.
1259
1259
1260
1260
`node` flags can be defined in Mocha's [configuration](#configuring-mocha-nodejs).
1261
1261
1262
-
> _New in v9.1.0_ You can also pass `node` flags to Node.js using [`--node-option`](#-node-option-name-n-name).
1262
+
> _Since v9.1.0_ You can also pass `node` flags to Node.js using [`--node-option`](#-node-option-name-n-name).
1263
1263
1264
1264
### `--enable-source-maps`
1265
1265
1266
-
> _New in Node.js v12.12.0_
1266
+
> _Since Node.js v12.12.0_
1267
1267
1268
1268
If the [`--enable-source-maps`](https://nodejs.org/dist/latest-v12.x/docs/api/cli.html#cli_enable_source_maps) flag
1269
1269
is passed to mocha, source maps will be collected and used to provide accurate stack traces for transpiled code:
@@ -1280,11 +1280,11 @@ Prepend `--v8-` to any flag listed in the output of `node --v8-options` (excludi
1280
1280
1281
1281
V8 flags can be defined in Mocha's [configuration](#configuring-mocha-nodejs).
1282
1282
1283
-
> _New in v9.1.0_ You can also pass V8 flags (without `--v8-`) to Node.js using [`--node-option`](#-node-option-name-n-name).
1283
+
> _Since v9.1.0_ You can also pass V8 flags (without `--v8-`) to Node.js using [`--node-option`](#-node-option-name-n-name).
1284
1284
1285
1285
## Parallel Tests
1286
1286
1287
-
> _New in v.8.0.0._
1287
+
> _Since v.8.0.0._
1288
1288
1289
1289
Depending on the number and nature of your tests, you may find a significant performance benefit when running tests in parallel (using the [`--parallel`](#-parallel-p) flag).
1290
1290
@@ -1411,13 +1411,13 @@ It's unlikely (but not impossible) to see a performance gain from a [job count](
1411
1411
1412
1412
### Parallel Mode Worker IDs
1413
1413
1414
-
> _New in v9.2.0_
1414
+
> _Since v9.2.0_
1415
1415
1416
1416
Each process launched by parallel mode is assigned a unique id, from 0 for the first process to be launched, to N-1 for the Nth process. This worker id may be accessed in tests via the environment variable `MOCHA_WORKER_ID`. It can be used for example to assign a different database, service port, etc for each test process.
1417
1417
1418
1418
## Root Hook Plugins
1419
1419
1420
-
> _New in v8.0.0_
1420
+
> _Since v8.0.0_
1421
1421
1422
1422
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.
1423
1423
@@ -1643,7 +1643,7 @@ If you're a library maintainer, and your library uses root hooks, you can migrat
1643
1643
1644
1644
## Global Fixtures
1645
1645
1646
-
> _New in v8.2.0_
1646
+
> _Since v8.2.0_
1647
1647
1648
1648
At first glance, _global fixtures_ seem similar to [root hooks](#root-hook-plugins). However, unlike root hooks, global fixtures:
1649
1649
@@ -2088,7 +2088,7 @@ Alias: `HTML`, `html`
2088
2088
2089
2089
## Node.JS native ESM support
2090
2090
2091
-
> _New in v7.1.0_
2091
+
> _Since v7.1.0_
2092
2092
2093
2093
Mocha supports writing your tests as ES modules, and not just using CommonJS. For example:
2094
2094
@@ -2214,7 +2214,7 @@ The HTML reporter is the default reporter when running Mocha in the browser. It
2214
2214
2215
2215
## Configuring Mocha (Node.js)
2216
2216
2217
-
> _New in v6.0.0_
2217
+
> _Since v6.0.0_
2218
2218
2219
2219
Mocha supports configuration files, typical of modern command-line tools, in several formats:
2220
2220
@@ -2310,7 +2310,7 @@ _Note_: Double quotes around the glob are recommended for portability.
2310
2310
2311
2311
## Error Codes
2312
2312
2313
-
> _New in v6.0.0_
2313
+
> _Since v6.0.0_
2314
2314
2315
2315
When Mocha itself throws exception, the associated `Error` will have a `code` property. Where applicable, consumers should check the `code` property instead of string-matching against the `message` property. The following table describes these error codes:
0 commit comments