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
+7-6Lines changed: 7 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -429,7 +429,7 @@ const fn = async x => { return new Promise(
429
429
430
430
describe('my suite', function() {
431
431
it(`expected value ${z}`, function() {
432
-
assert.equal(z, 6);
432
+
assert.strictEqual(z, 6);
433
433
});
434
434
});
435
435
@@ -439,7 +439,7 @@ const fn = async x => { return new Promise(
439
439
440
440
## Pending Tests
441
441
442
-
"Pending"--as in "someone should write these test cases eventually"--test-cases are those _without_ a callback:
442
+
"Pending" — as in "someone should write these test cases eventually" — test-cases are those _without_ a callback:
443
443
444
444
```js
445
445
describe('Array', function() {
@@ -752,13 +752,11 @@ import assert from 'assert';
752
752
753
753
// top-level await: Node >= v14.8.0 with ESM test file
754
754
consttests=awaitnewPromise(resolve=> {
755
-
setTimeout(() => {
756
-
resolve([
755
+
setTimeout(resolve, 5000, [
757
756
{args: [1, 2], expected:3},
758
757
{args: [1, 2, 3], expected:6},
759
758
{args: [1, 2, 3, 4], expected:10}
760
-
]);
761
-
}, 5000);
759
+
]);
762
760
});
763
761
764
762
// in suites ASYNCHRONOUS callbacks are NOT supported
@@ -1389,6 +1387,8 @@ In some cases, you may want a [hook](#hooks) before (or after) every test in eve
1389
1387
1390
1388
A _Root Hook Plugin_ is a JavaScript file loaded via [`--require`](#-require-module-r-module) which "registers" one or more root hooks to be used across all test files.
1391
1389
1390
+
In browsers you can set root hooks directly via a `rootHooks` object: `mocha.setup({ rootHooks: beforeEach() {...} })`, also see [`mocha.setup()`](#running-mocha-in-the-browser)
1391
+
1392
1392
### Defining a Root Hook Plugin
1393
1393
1394
1394
A Root Hook Plugin file is a script which exports (via `module.exports`) a `mochaHooks` property. It is loaded via `--require <file>`.
0 commit comments