Skip to content

Commit bb2e69a

Browse files
docs: refresh help output, fix stale links (#6357)
1 parent 921c161 commit bb2e69a

4 files changed

Lines changed: 61 additions & 104 deletions

File tree

‎docs/src/content/docs/blog/mocha-12-stable.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ Those new minimum versions are intentionally the lowest Node.js versions that su
3737
We intentionally chose those versions so that programmatic integrators can continue to `require("mocha")`, though we do recommend updating to ECMAScript Modules (ESM) if possible.
3838

3939
Accordingly, Mocha's minimum supported browser versions are those that were stable as of [Node.js 20.0.0](https://nodejs.org/en/blog/release/v20.0.0)'s release on April 18, 2023:
40-
[Chrome 112](https://developer.chrome.com/blog/new-in-chrome-112), [Edge 112](https://learn.microsoft.com/en-us/deployedge/microsoft-edge-relnote-archive-stable-channel#version-1120172248-april-14-2023), [Firefox 112](https://www.mozilla.org/en-US/firefox/112.0/releasenotes), and [Safari 16.4](https://developer.apple.com/documentation/safari-release-notes/safari-16_4-release-notes).
40+
[Chrome 112](https://developer.chrome.com/blog/new-in-chrome-112), [Edge 112](https://learn.microsoft.com/en-us/deployedge/microsoft-edge-relnote-archive-stable-channel#version-1120172248-april-14-2023), [Firefox 112](https://www.mozilla.org/en-US/firefox/112.0/releasenotes/), and [Safari 16.4](https://developer.apple.com/documentation/safari-release-notes/safari-16_4-release-notes).
4141

4242
We know that Node 20 is now EOL,
4343
but we didn't want to jump 2 LTS versions in one release.
4444
Mocha 13 will drop support for Node 20.
4545

46-
See [#5358 🧹 Versioning: Bump minimum Node.js version from 18.18.0 to 20.19.0](https://github.com/mochajs/mocha/issues/5477) and [feat!: bump minimum Node.js version from 18.18.0 to 20.19.0 (#5477)](https://github.com/mochajs/mocha/pull/5477) for more details.
46+
See [#5358 🧹 Versioning: Bump minimum Node.js version from 18.18.0 to 20.19.0](https://github.com/mochajs/mocha/issues/5358) and [feat!: bump minimum Node.js version from 18.18.0 to 20.19.0 (#5477)](https://github.com/mochajs/mocha/pull/5477) for more details.
4747

4848
### ECMAScript Modules (ESM) package
4949

‎docs/src/content/docs/reporters/doc.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ The command `mocha --reporter doc array` would yield:
4343
</section>
4444
```
4545

46-
The SuperAgent request library [test documentation](https://ladjs.github.io/superagent/docs/test.html) was generated with Mocha's doc reporter using this Bash command:
46+
The SuperAgent request library [test documentation](https://forwardemail.github.io/superagent/docs/test.html) was generated with Mocha's doc reporter using this Bash command:
4747

4848
```bash
4949
$ mocha --reporter=doc | cat docs/head.html - docs/tail.html > docs/test.html

‎docs/src/content/docs/running/browsers.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ As of Mocha v12.0.0, that includes the following browser versions that were stab
4242

4343
- [Chrome 112](https://developer.chrome.com/blog/new-in-chrome-112)
4444
- [Edge 112](https://learn.microsoft.com/en-us/deployedge/microsoft-edge-relnote-archive-stable-channel#version-1120172248-april-14-2023)
45-
- [Firefox 112](https://www.mozilla.org/en-US/firefox/112.0/releasenotes)
45+
- [Firefox 112](https://www.mozilla.org/en-US/firefox/112.0/releasenotes/)
4646
- [Safari 16.4](https://developer.apple.com/documentation/safari-release-notes/safari-16_4-release-notes)
4747

4848
## Grep

‎docs/src/content/docs/running/cli.mdx‎

Lines changed: 57 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -5,102 +5,62 @@ description: Running Mocha in your terminal.
55

66
Running `npx mocha --help` will show the full list of available commands:
77

8-
{/* This output is defined in lib/cli/run.cjs */}
8+
{/* This output is defined in lib/cli/cli.js and lib/cli/run-option-metadata.cjs */}
99

1010
```plaintext
11-
mocha [spec..]
12-
13-
Run tests with Mocha
14-
15-
Commands
16-
mocha inspect [spec..] Run tests with Mocha [default]
17-
mocha init <path> create a client-side Mocha setup at <path>
18-
19-
Rules & Behavior
20-
--allow-uncaught Allow uncaught errors to propagate [boolean]
21-
-A, --async-only Require all tests to use a callback (async)
22-
or return a Promise [boolean]
23-
-b, --bail Abort ("bail") after first test failure
24-
[boolean]
25-
--check-leaks Check for global variable leaks [boolean]
26-
--delay Delay initial execution of root suite
27-
[boolean]
28-
--dry-run Report tests without executing them[boolean]
29-
--exit Force Mocha to quit after tests complete
30-
[boolean]
31-
--pass-on-failing-test-suite Not fail test run if tests were failed
32-
[boolean] [default: false]
33-
--fail-hook-affected-tests Report tests as failed when affected by hook
34-
failures (before/beforeEach) [boolean]
35-
--fail-zero Fail test run if no test(s) encountered
36-
[boolean]
37-
--forbid-only Fail if exclusive test(s) encountered
38-
[boolean]
39-
--forbid-pending Fail if pending test(s) encountered[boolean]
40-
--global, --globals List of allowed global variables [array]
41-
-j, --jobs Number of concurrent jobs for --parallel;
42-
use 1 to run in serial
43-
[number] [default: (number of CPU cores - 1)]
44-
-p, --parallel Run tests in parallel [boolean]
45-
--posix-exit-codes Use POSIX and UNIX shell exit codes as
46-
Mocha's return value [boolean]
47-
--retries Retry failed tests this many times [number]
48-
-s, --slow Specify "slow" test threshold (in
49-
milliseconds) [string] [default: 75]
50-
-t, --timeout, --timeouts Specify test timeout threshold (in
51-
milliseconds) [string] [default: 2000]
52-
-u, --ui Specify user interface
53-
[string] [default: "bdd"]
54-
55-
Reporting & Output
56-
-c, --color, --colors Force-enable color output [boolean]
57-
--diff Show diff on failure
58-
[boolean] [default: true]
59-
--full-trace Display full stack traces [boolean]
60-
--inline-diffs Display actual/expected differences
61-
inline within each string [boolean]
62-
-R, --reporter Specify reporter to use
63-
[string] [default: "spec"]
64-
-O, --reporter-option, Reporter-specific options
65-
--reporter-options (<k=v,[k1=v1,..]>) [array]
66-
--clear-screen Clear the terminal before each run
67-
in watch mode [boolean]
68-
69-
Configuration
70-
--config Path to config file [string] [default: (nearest rc file)]
71-
-n, --node-option Node or V8 option (no leading "--") [array]
72-
--package Path to package.json for config [string]
73-
74-
File Handling
75-
--extension File extension(s) to load
76-
[array] [default: ["js","cjs","mjs"]]
77-
--file Specify file(s) to be loaded prior to root suite
78-
execution [array] [default: (none)]
79-
--ignore, --exclude Ignore file(s) or glob pattern(s)
80-
[array] [default: (none)]
81-
--recursive Look for tests in subdirectories [boolean]
82-
-r, --require Require module [array] [default: (none)]
83-
-S, --sort Sort test files [boolean]
84-
-w, --watch Watch files in the current working directory for
85-
changes [boolean]
86-
--watch-files List of paths or globs to watch [array]
87-
--watch-ignore List of paths or globs to exclude from watching
88-
[array] [default: ["node_modules",".git"]]
89-
90-
Test Filters
91-
-f, --fgrep Only run tests containing this string [string]
92-
-g, --grep Only run tests matching this string or regexp [string]
93-
-i, --invert Inverts --grep and --fgrep matches [boolean]
94-
95-
Positional Arguments
96-
spec One or more files, directories, or globs to test
97-
[array] [default: ["test"]]
98-
99-
Other Options
100-
-h, --help Show usage information & exit [boolean]
101-
-V, --version Show version number & exit [boolean]
102-
--list-interfaces List built-in user interfaces & exit [boolean]
103-
--list-reporters List built-in reporters & exit [boolean]
11+
Usage: mocha [spec..]
12+
mocha init <path>
13+
14+
Commands:
15+
init <path> create a client-side Mocha setup at <path>
16+
17+
Options:
18+
--extension File extension(s) to load
19+
--file Specify file(s) to be loaded prior to root suite execution
20+
--global, --globals List of allowed global variables
21+
--ignore, --exclude Ignore file(s) or glob pattern(s)
22+
--node-option, -n Node or V8 option (no leading "--")
23+
--reporter-option, --reporter-options, -O Reporter-specific options (<k=v,[k1=v1,..]>)
24+
--require, -r Require module
25+
--watch-files List of paths or globs to watch
26+
--watch-ignore List of paths or globs to exclude from watching
27+
--allow-uncaught Allow uncaught errors to propagate
28+
--async-only, -A Require all tests to use a callback (async) or return a Promise
29+
--bail, -b Abort ("bail") after first test failure
30+
--check-leaks Check for global variable leaks
31+
--color, -c, --colors Force-enable color output
32+
--delay Delay initial execution of root suite
33+
--diff Show diff on failure
34+
--dry-run Report tests without executing them
35+
--exit Force Mocha to quit after tests complete
36+
--fail-hook-affected-tests Report tests as failed when affected by hook failures (before/beforeEach)
37+
--pass-on-failing-test-suite Not fail test run if tests were failed
38+
--fail-zero Fail test run if no test(s) encountered
39+
--forbid-only Fail if exclusive test(s) encountered
40+
--forbid-pending Fail if pending test(s) encountered
41+
--full-trace Display full stack traces
42+
--inline-diffs Display actual/expected differences inline within each string
43+
--invert, -i Inverts --grep and --fgrep matches
44+
--list-interfaces List built-in user interfaces & exit
45+
--list-reporters List built-in reporters & exit
46+
--no-colors, -C Force-disable color output
47+
--parallel, -p Run tests in parallel
48+
--posix-exit-codes Use POSIX and UNIX shell exit codes as Mocha's return value
49+
--recursive Look for tests in subdirectories
50+
--sort, -S Sort test files
51+
--watch, -w Watch files in the current working directory for changes
52+
--retries Retry failed tests this many times
53+
--jobs, -j Number of concurrent jobs for --parallel; use 1 to run in serial
54+
--config Path to config file
55+
--fgrep, -f Only run tests containing this string
56+
--grep, -g Only run tests matching this string or regexp
57+
--package Path to package.json for config
58+
--reporter, -R Specify reporter to use
59+
--ui, -u Specify user interface
60+
--slow, -s Specify "slow" test threshold (in milliseconds)
61+
--timeout, -t, --timeouts Specify test timeout threshold (in milliseconds)
62+
--help, -h Show usage information & exit
63+
--version, -V Show version number & exit
10464
10565
Mocha Resources
10666
Chat: https://discord.gg/KeDn2uXhER
@@ -175,7 +135,7 @@ It _can_ be time-consuming to debug--because it's not always obvious where the p
175135

176136
To ensure your tests aren't leaving messes around, here are some ideas to get started:
177137

178-
- See the [Node.js guide to debugging](https://nodejs.org/en/docs/inspector)
138+
- See the [Node.js guide to debugging](https://nodejs.org/en/learn/getting-started/debugging)
179139
- Use the new [`async_hooks`](https://github.com/nodejs/node/blob/master/doc/api/async_hooks.md) API ([example](https://gist.github.com/boneskull/7fe75b63d613fa940db7ec990a5f5843))
180140
- Try something like [wtfnode](https://npm.im/wtfnode)
181141
- Use [`.only`](/declaring/exclusive-tests) until you find the test that causes Mocha to hang
@@ -630,7 +590,7 @@ Implies `--timeout 0`.
630590
:::note[Updated in v6.0.0]
631591
:::
632592

633-
Each flag annotated of type `[boolean]` in Mocha's `--help` output can be _negated_ by prepending `--no-` to the flag name.
593+
Each boolean flag can be _negated_ by prepending `--no-` to the flag name.
634594
For example, `--no-color` will disable Mocha's color output, which is enabled by default.
635595

636596
Unless otherwise noted, _all_ boolean flags default to `false`.
@@ -649,10 +609,7 @@ You can also pass `node` flags to Node.js using [`--node-option`](#--node-option
649609

650610
### `--enable-source-maps`
651611

652-
:::note[New in Node.js v12.12.0]
653-
:::
654-
655-
If the [`--enable-source-maps`](https://nodejs.org/dist/latest-v12.x/docs/api/cli.html#cli_enable_source_maps) flag
612+
If the [`--enable-source-maps`](https://nodejs.org/api/cli.html#--enable-source-maps) flag
656613
is passed to Mocha, source maps will be collected and used to provide accurate stack traces for transpiled code:
657614

658615
```bash

0 commit comments

Comments
 (0)