Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

docs: fix inconsistencies in docs (#6000)

Mostafa Nazari6310d0ef5e20
diff --git a/docs/src/content/docs/explainers/programmatic-usage.mdx b/docs/src/content/docs/explainers/programmatic-usage.mdx
index 973282a2..c1a99aa3 100644
--- a/docs/src/content/docs/explainers/programmatic-usage.mdx
+++ b/docs/src/content/docs/explainers/programmatic-usage.mdx
@@ -33,9 +33,9 @@ mocha.run(function (failures) {
});
```
-`mocha.run()` returns a `Runner` instance which emits many [events](https://github.com/mochajs/mocha/blob/9a7053349589344236b20301de965030eaabfea9/lib/runner.js#L52) of interest.
+`mocha.run()` returns a `Runner` instance which emits many [events](https://github.com/mochajs/mocha/blob/main/lib/runner.js) of interest, exposed as `Mocha.Runner.constants` (e.g. `EVENT_TEST_PASS`, `EVENT_TEST_FAIL`, `EVENT_RUN_END`).
-Note that `run` (via `loadFiles`, which it calls) relies on Node's `require` to execute the test interface functions. Thus, files loaded by Mocha will be stored in Node's `require` cache and therefore tests in these files will not be re-run if `mocha.run()` is called again. If you want to run tests multiple times, you may need to clear Node's `require` cache before subsequent calls in whichever manner best suits your needs. The upcoming Mocha-6.0 release will provide `Mocha#unloadFiles`, which will remove all files loaded by `Mocha#loadFiles`.
+Note that `run` (via `loadFiles`, which it calls) relies on Node's `require` to execute the test interface functions. Thus, files loaded by Mocha will be stored in Node's `require` cache and therefore tests in these files will not be re-run if `mocha.run()` is called again. If you want to run tests multiple times, you may need to clear Node's `require` cache before subsequent calls in whichever manner best suits your needs. `Mocha#unloadFiles` is also available and will remove all files loaded by `Mocha#loadFiles`.
Unfortunately, event listeners in multiple places are not yet configured for restartability; for now, we recommend recreating the `mocha` instance before rerunning to _ensure_ everything gets reset properly.
diff --git a/docs/src/content/docs/explainers/typescript.mdx b/docs/src/content/docs/explainers/typescript.mdx
index e623f252..effd7095 100644
--- a/docs/src/content/docs/explainers/typescript.mdx
+++ b/docs/src/content/docs/explainers/typescript.mdx
@@ -45,10 +45,10 @@ Or in `.mocharc.js`:
```js
export default {
- "node-option": ["strip-types"]
- "extension": ["js", "ts"]
- "spec": ["test/**/*.ts"]
-}
+ "node-option": ["experimental-strip-types"],
+ extension: ["js", "ts"],
+ spec: ["test/**/*.ts"],
+};
```
:::note
diff --git a/docs/src/content/docs/features/global-fixtures.mdx b/docs/src/content/docs/features/global-fixtures.mdx
index bed58dba..8b3f6617 100644
--- a/docs/src/content/docs/features/global-fixtures.mdx
+++ b/docs/src/content/docs/features/global-fixtures.mdx
@@ -10,7 +10,7 @@ At first glance, _global fixtures_ seem similar to [root hook plugins](/features
However, unlike root hooks, global fixtures:
1. Are _guaranteed_ to execute _once and only once_
-1. Work identically parallel mode, watch mode, and serial mode
+1. Work identically in parallel mode, watch mode, and serial mode
1. Do not share a context with tests, suites, or other hooks
There are two types of global fixtures: [global setup fixtures](#global-setup-fixtures) and [global teardown fixtures](#global-teardown-fixtures).
diff --git a/docs/src/content/docs/features/root-hook-plugins.mdx b/docs/src/content/docs/features/root-hook-plugins.mdx
index 5bfde72d..209164e6 100644
--- a/docs/src/content/docs/features/root-hook-plugins.mdx
+++ b/docs/src/content/docs/features/root-hook-plugins.mdx
@@ -238,7 +238,7 @@ describe("my test suite", function () {
Running `mocha --require test/hooks.js test/test.spec.js` will run as before (and is now ready to be used with [`--parallel`](/running/cli#--parallel--p)).
-## Migrating a Library to use Root Hook PLugins
+## Migrating a Library to use Root Hook Plugins
If you're a library maintainer, and your library uses root hooks, you can migrate by refactoring your entry point: