Skip to content

armgit / mocha

Public Imported from GitHub
0

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

tweak timeout/hook docs

Christopher Hiller390396dbaf22
diff --git a/index.md b/index.md
index 99acb004..713cfd58 100644
--- a/index.md
+++ b/index.md
@@ -615,17 +615,19 @@ it('should take less than 500ms', function(done){
### Hook-level
-Hook-level timeouts may also be applied, or the use of `this.timeout(0)` to disable timeout for a hook:
+Hook-level timeouts may also be applied:
```js
describe('a suite of tests', function() {
beforeEach(function(done) {
- this.timeout(3000); // A very long evironment setup.
+ this.timeout(3000); // A very long environment setup.
setTimeout(done, 2500);
});
});
```
+Again, use `this.timeout(0)` to disable the timeout for a hook.
+
## Diffs
Mocha supports the `err.expected` and `err.actual` properties of any thrown `AssertionError`s from an assertion library. Mocha will attempt to display the difference between what was expected, and what the assertion actually saw. Here's an example of a "string" diff: