Skip to content

Commit b88d441

Browse files
docs: add ClientRedirects.astro (#5324)
* docs: add ClientRedirects.astro * Update docs-next/src/content/docs/interfaces/about.mdx Co-authored-by: Mark Wiemer <[email protected]> --------- Co-authored-by: Mark Wiemer <[email protected]>
1 parent 6ec5762 commit b88d441

File tree

8 files changed

+231
-14
lines changed

8 files changed

+231
-14
lines changed

docs-next/astro.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export default defineConfig({
4444
{ label: "Arrow functions", slug: "features/arrow-functions" },
4545
{ label: "Assertions", slug: "features/assertions" },
4646
{ label: "Asynchronous code", slug: "features/asynchronous-code" },
47+
{ label: "Diffs", slug: "features/diffs" },
4748
{ label: "Error codes", slug: "features/error-codes" },
4849
{ label: "Global fixtures", slug: "features/global-fixtures" },
4950
{ label: "Hooks", slug: "features/hooks" },
@@ -56,6 +57,7 @@ export default defineConfig({
5657
{
5758
collapsed: true,
5859
items: [
60+
{ label: "About", slug: "interfaces/about" },
5961
{ label: "BDD (default)", slug: "interfaces/bdd" },
6062
{ label: "TDD", slug: "interfaces/tdd" },
6163
{ label: "Exports", slug: "interfaces/exports" },
@@ -68,6 +70,7 @@ export default defineConfig({
6870
{
6971
collapsed: true,
7072
items: [
73+
{ label: "About", slug: "reporters/about" },
7174
{ label: "Spec (default)", slug: "reporters/spec" },
7275
{ label: "Doc", slug: "reporters/doc" },
7376
{ label: "Dot", slug: "reporters/dot" },
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
<script>
2+
const knownHashes = {
3+
"-allow-uncaught": "running/cli/#--allow-uncaught",
4+
"-async-only-a": "running/cli/#--async-only--a",
5+
"-bail-b": "running/cli/#--bail--b",
6+
"-check-leaks": "running/cli/#--check-leaks",
7+
"-color-c-colors": "running/cli/#--color--c---colors",
8+
"-compilers": "running/cli/#--compilers",
9+
"-config-path": "running/cli/#--config-path",
10+
"-diff": "running/cli/#--diff",
11+
"-dry-run": "running/cli/#--dry-run",
12+
"-enable-source-maps": "running/cli/#--enable-source-maps",
13+
"-exit": "running/cli/#--exit",
14+
"-extension-ext": "running/cli/#--extension-ext",
15+
"-fail-zero": "running/cli/#--fail-zero",
16+
"-fgrep-string-f-string": "running/cli/#--fgrep-string--f-string",
17+
"-file-file": "running/cli/#--file-file",
18+
"-forbid-only": "running/cli/#--forbid-only",
19+
"-forbid-pending": "running/cli/#--forbid-pending",
20+
"-full-trace": "running/cli/#--full-trace",
21+
"-global-variable-name": "running/cli/#--global-variable-name",
22+
"-grep-regexp-g-regexp": "running/cli/#--grep-regexp--g-regexp",
23+
"-ignore-filedirectoryglob-exclude-filedirectoryglob":
24+
"running/cli/#--ignore-filedirectoryglob---exclude-filedirectoryglob",
25+
"-inline-diffs": "running/cli/#--inline-diffs",
26+
"-inspect-inspect-brk-inspect":
27+
"running/cli/#--inspect---inspect-brk-inspect",
28+
"-invert": "running/cli/#--invert",
29+
"-jobs-count-j-count": "running/cli/#--jobs-count--j-count",
30+
"-node-option-name-n-name": "running/cli/#--node-option-name--n-name",
31+
"-opts-path": "running/cli/#--opts-path",
32+
"-package-path": "running/cli/#--package-path",
33+
"-parallel-p": "running/cli/#--parallel--p",
34+
"-pass-on-failing-test-suite": "running/cli/#--pass-on-failing-test-suite",
35+
"-recursive": "running/cli/#--recursive",
36+
"-reporter-name-r-name": "running/cli/#--reporter-name--r-name",
37+
"-reporter-option-option-o-option-reporter-options-option":
38+
"running/cli/#--reporter-option-option--o-option---reporter-options-option",
39+
"-require-module-r-module": "running/cli/#--require-module--r-module",
40+
"-retries-n": "running/cli/#--retries-n",
41+
"-slow-ms-s-ms": "#--slow-ms--s-ms",
42+
"-sort-s": "running/cli/#--sort--s",
43+
"-timeout-ms-t-ms": "running/cli/#--timeout-ms--t-ms",
44+
"-ui-name-u-name": "running/cli/#--ui-name--u-name",
45+
"-watch-files-filedirectoryglob":
46+
"running/cli/#--watch-files-filedirectoryglob",
47+
"-watch-ignore-filedirectoryglob":
48+
"running/cli/#--watch-ignore-filedirectoryglob",
49+
"-watch-w": "running/cli/#--watch--w",
50+
"about-node-flags": "running/cli/#about-node-flags",
51+
"about-option-types": "running/cli/#about-option-types",
52+
"about-v8-flags": "running/cli/#about-v8-flags",
53+
"arrow-functions": "features/arrow-functions",
54+
assertions: "features/assertions",
55+
"asynchronous-code": "features/asynchronous-code",
56+
"asynchronous-hooks": "features/hooks/#asynchronous-hooks",
57+
"available-root-hooks": "features/root-hook-plugins/#available-root-hooks",
58+
backers: "#backers",
59+
"bail-is-best-effort": "features/parallel-mode/#bail-is-best-effort",
60+
bdd: "interfaces/bdd",
61+
"browser-configuration": "running/browsers/#browser-configuration",
62+
"browser-specific-options": "running/browsers/#browser-specific-options",
63+
"caveats-about-testing-in-parallel":
64+
"features/parallel-mode/#caveats-about-testing-in-parallel",
65+
"command-line-usage": "running/cli",
66+
"configuration-format": "running/configuring/#configuration-format",
67+
"configuring-mocha-nodejs": "running/configuring",
68+
"current-limitations":
69+
"explainers/nodejs-native-esm-support#current-limitations",
70+
"custom-locations": "running/configuring/#custom-locations",
71+
"defining-a-root-hook-plugin":
72+
"features/root-hook-plugins#defining-a-root-hook-plugin",
73+
"delayed-root-suite": "features/hooks/#root-level-hooks",
74+
"describing-hooks": "features/hooks/#describing-hooks",
75+
"detects-multiple-calls-to-done":
76+
"explainers/detecting-multiple-calls-to-done",
77+
diffs: "features/diffs",
78+
doc: "reporters/doc",
79+
"dot-matrix": "reporters/dot-matrix",
80+
"dynamically-generating-tests": "declaring/dynamic-tests",
81+
"editor-plugins": "running/editor-plugins",
82+
emacs: "running/editor-plugins/#emacs",
83+
"environment-variables": "running/configuring/#environment-variables",
84+
"error-codes": "features/error-codes",
85+
examples: "getting-started#next-steps",
86+
"exclusive-tests": "declaring/exclusive-tests",
87+
"exclusive-tests-are-disallowed":
88+
"features/parallel-mode/#exclusive-tests-are-disallowed",
89+
exports: "interfaces/exports",
90+
"extending-configuration": "running/configuring/#extending-configuration",
91+
"file-order-is-non-deterministic":
92+
"features/parallel-mode/#file-order-is-non-deterministic",
93+
"getting-started": "getting-started",
94+
"global-fixtures": "features/global-fixtures",
95+
"global-setup-fixtures": "features/global-fixtures/#global-setup-fixtures",
96+
"global-teardown-fixtures":
97+
"features/global-fixtures/#global-teardown-fixtures",
98+
grep: "running/browsers/#grep",
99+
"hook-level": "features/timeouts#hook-level",
100+
hooks: "features/hooks",
101+
"html-reporter": "reporters/html",
102+
"ignoring-config-files": "running/configuring/#ignoring-config-files",
103+
"inclusive-tests": "declaring/inclusive-tests",
104+
installation: "getting-started#1-installation",
105+
interfaces: "interfaces/about",
106+
jetbrains: "running/editor-plugins/#jetbrains",
107+
json: "reporters/json",
108+
"json-stream": "reporters/json-stream",
109+
"landing-strip": "reporters/landing",
110+
"limitations-of-asynchronous-callbacks":
111+
"features/asynchronous-code/#limitations-of-asynchronous-callbacks",
112+
"limited-reporter-api-for-third-party-reporters":
113+
"features/parallel-mode/#limited-reporter-api-for-third-party-reporters",
114+
list: "reporters/list",
115+
markdown: "reporters/markdown",
116+
merging: "running/configuring/#merging",
117+
"migrating-a-library-to-use-root-hook-plugins":
118+
"features/root-hook-plugins#migrating-a-library-to-use-root-hook-plugins",
119+
"migrating-tests-to-use-root-hook-plugins":
120+
"features/root-hook-plugins#migrating-tests-to-use-root-hook-plugins",
121+
min: "reporters/min",
122+
"mocha-fixture-wizard": "explainers/test-fixture-decision-tree",
123+
"mocha-fixture-wizard-diagram": "explainers/test-fixture-decision-tree",
124+
"mocha-sidebar-vs-code": "running/editor-plugins/#mocha-sidebar-vs-code",
125+
"more-information": "#more-information",
126+
"multiple-root-hook-plugins":
127+
"features/root-hook-plugins#multiple-root-hook-plugins",
128+
"multiple-root-hooks-in-a-single-plugin":
129+
"features/root-hook-plugins#multiple-root-hooks-in-a-single-plugin",
130+
"no-browser-support": "features/parallel-mode/#no-browser-support",
131+
"nodejs-native-esm-support": "explainers/nodejs-native-esm-support",
132+
nyan: "reporters/nyan",
133+
"options-that-differ-slightly-from-cli-options":
134+
"running/browsers/#options-that-differ-slightly-from-cli-options",
135+
"options-that-only-function-in-browser-context":
136+
"running/browsers/#options-that-only-function-in-browser-context",
137+
"parallel-mode": "explainers/run-cycle-overview#parallel-mode",
138+
"parallel-mode-worker-ids":
139+
"features/parallel-mode/#parallel-mode-worker-ids",
140+
"parallel-tests": "features/parallel-mode",
141+
"pending-tests": "declaring/pending-tests",
142+
priorities: "running/configuring/#priorities",
143+
progress: "reporters/progress",
144+
qunit: "interfaces/qunit",
145+
"reporter-limitations": "features/parallel-mode/#reporter-limitations",
146+
reporters: "reporters/about",
147+
reporting: "running/browsers/#reporting",
148+
require: "interfaces/require",
149+
"retry-tests": "declaring/retrying-tests",
150+
"root-hook-plugins": "features/root-hook-plugins",
151+
"root-hook-plugins-can-export-a-function":
152+
"features/root-hook-plugins#root-hook-plugins-can-export-a-function",
153+
"root-hooks-are-not-global":
154+
"features/parallel-mode/#root-hooks-are-not-global",
155+
"root-level-hooks": "features/hooks/#root-level-hooks",
156+
"run-cycle-overview": "explainers/run-cycle-overview",
157+
"running-mocha-in-the-browser": "running/browsers",
158+
"serial-mode": "explainers/run-cycle-overview#serial-mode",
159+
spec: "reporters/spec",
160+
sponsors: "#sponsors",
161+
"suite-level": "features/timeouts#suite-level",
162+
"synchronous-code": "features/asynchronous-code/#synchronous-code",
163+
tap: "reporters/tap",
164+
tdd: "interfaces/tdd",
165+
"test-duration": "explainers/test-duration",
166+
"test-duration-variability":
167+
"features/parallel-mode/#test-duration-variability",
168+
"test-fixture-decision-tree-wizard-thing":
169+
"explainers/test-fixture-decision-tree",
170+
"test-level": "features/timeouts#test-level",
171+
textmate: "running/editor-plugins/#textmate",
172+
"the-test-directory": "running/test-globs",
173+
"third-party-reporters": "reporters/third-party",
174+
timeouts: "features/timeouts",
175+
"troubleshooting-parallel-mode":
176+
"features/parallel-mode/#no-browser-support",
177+
"using-async-await": "features/asynchronous-code/#using-async--await",
178+
wallabyjs: "running/editor-plugins/#wallabyjs",
179+
"when-not-to-use-global-fixtures":
180+
"features/global-fixtures/#when-not-to-use-global-fixtures",
181+
"when-to-use-global-fixtures":
182+
"features/global-fixtures/#when-to-use-global-fixtures",
183+
"with-commonjs": "features/root-hook-plugins#with-commonjs",
184+
"with-es-modules": "features/root-hook-plugins#with-es-modules",
185+
"working-with-promises":
186+
"features/asynchronous-code/#working-with-promises",
187+
xunit: "reporters/xunit",
188+
};
189+
190+
const hash = window.location.hash.slice(1);
191+
192+
if (Object.hasOwn(knownHashes, hash)) {
193+
window.location.href = [
194+
window.location.pathname,
195+
knownHashes[hash as keyof typeof knownHashes],
196+
].join("/");
197+
}
198+
</script>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
description: Displaying actual vs. expected data in test failures.
3+
title: Diffs
4+
---
5+
6+
Mocha supports the `err.expected` and `err.actual` properties of any thrown `AssertionError`s from an assertion library.
7+
Mocha will attempt to display the difference between what was expected and what the assertion actually saw.
8+
Here's an example of a "string" diff using `--inline-diffs`:
9+
10+
![string diffs](./reporter-string-diffs.png)

docs-next/src/content/docs/features/timeouts.mdx

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ description: Managing timing for non-synchronous tests.
33
title: Timeouts
44
---
55

6-
## Timeouts
7-
8-
### Suite-level
6+
## Suite-level
97

108
Suite-level timeouts may be applied to entire test "suites", or disabled via `this.timeout(0)`.
119
This will be inherited by all nested suites and test-cases that do not override the value.
@@ -24,7 +22,7 @@ describe("a suite of tests", function () {
2422
});
2523
```
2624

27-
### Test-level
25+
## Test-level
2826

2927
Test-specific timeouts may also be applied, or the use of `this.timeout(0)` to disable timeouts all together:
3028

@@ -35,7 +33,7 @@ it("should take less than 500ms", function (done) {
3533
});
3634
```
3735

38-
### Hook-level
36+
## Hook-level
3937

4038
Hook-level timeouts may also be applied:
4139

@@ -60,11 +58,3 @@ In v8.0.0 or newer, `this.enableTimeouts()` has been removed.
6058
:::caution
6159
With async tests if you disable timeouts via `this.timeout(0)` and then do not call `done()`, your test will exit silently.
6260
:::
63-
64-
## Diffs
65-
66-
Mocha supports the `err.expected` and `err.actual` properties of any thrown `AssertionError`s from an assertion library.
67-
Mocha will attempt to display the difference between what was expected and what the assertion actually saw.
68-
Here's an example of a "string" diff using `--inline-diffs`:
69-
70-
![string diffs](./reporter-string-diffs.png)

docs-next/src/content/docs/getting-started.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ See:
7575
- [Configuring](./running/configuring) for creating a persistent test configuration file
7676
- [Editor Plugins](./running/editor-plugins) for improving the Mocha experience in your editor
7777

78-
You can see real live live example code in our example repositories:
78+
You can see real live example code in our example repositories:
7979

8080
- [Mocha examples](https://github.com/mochajs/mocha-examples)
8181
- [Express](https://github.com/visionmedia/express/tree/master/test)

docs-next/src/content/docs/index.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { Image } from "astro:assets";
1111

1212
import supporters from "../data/supporters.json";
1313
import Badges from "../../components/Badges.astro";
14+
import ClientRedirects from "../../components/ClientRedirects.astro";
1415
import Supporters from "../../components/Supporters.astro";
1516

1617
:::note[New Site Preview]
@@ -55,3 +56,5 @@ spies, mocking, and shared behaviours be sure to check out the [Mocha Wiki](http
5556
For a running example of Mocha, view [example/tests.html](example/tests.html).
5657

5758
For the JavaScript API, view the [API documentation](/api) or the [source](https://github.com/mochajs/mocha/blob/main/lib/mocha.js).
59+
60+
<ClientRedirects client:load />
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
description: Mocha's available DSLs for writing tests.
3+
title: About Interfaces
4+
---
5+
6+
Interfaces are how developers write tests to be executed by Mocha.
7+
Mocha's "interface" system allows developers to choose their style of DSL (domain-specific language).
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
description: How Mocha.js displays tests results as they execute and/or as a results summary.
3+
title: About Reporters
4+
---
5+
6+
Mocha reporters adjust to the terminal window, and always disable ANSI-escape coloring when the stdio streams are not associated with a TTY.

0 commit comments

Comments
 (0)