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
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -334,6 +334,17 @@ describe('my suite', () => {
334
334
335
335
_If you do not need to use_ Mocha's context, lambdas should work. Be aware that using lambdas will be more painful to refactor if the need eventually arises!
336
336
337
+
Alternatively, you can override certain context variables, such as test timeouts, by chain-calling methods of the created tests and/or hooks:
338
+
339
+
```js
340
+
describe('my suite', () => {
341
+
beforeEach(() => {}).timeout(1000);
342
+
it('my test', () => {
343
+
assert.ok(true);
344
+
}).timeout(1000);
345
+
}).timeout(1000);
346
+
```
347
+
337
348
## Hooks
338
349
339
350
With its default "BDD"-style interface, Mocha provides the hooks `before()`, `after()`, `beforeEach()`, and `afterEach()`. These should be used to set up preconditions and clean up after your tests.
0 commit comments