Skip to content

Commit

Permalink
Document no-setup-in-describe suite config exception
Browse files Browse the repository at this point in the history
  • Loading branch information
straub committed Sep 5, 2019
1 parent a34ccf9 commit 0569acd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/rules/no-setup-in-describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Any setup directly in a `describe` is run before all tests execute. This is unde
1. When doing TDD in a large codebase, all setup is run for tests that don't have `only` set. This can add a substantial amount of time per iteration.
2. If global state is altered by the setup of another describe block, your test may be affected.

This rule reports all function calls and use of the dot operator (due to getters and setters) directly in describe blocks.
This rule reports all function calls and use of the dot operator (due to getters and setters) directly in describe blocks. An exception is made for Mocha's suite configuration methods, like `this.timeout();`, which do not represent setup logic.

If you're using [dynamically generated tests](https://mochajs.org/#dynamically-generating-tests), you should disable this rule.

Expand Down Expand Up @@ -68,4 +68,8 @@ describe('something', function () {
const { a, b } = setup();
});
});
describe('something', function () {
this.timeout(5000);
it('should take awhile', function () {});
});
```

0 comments on commit 0569acd

Please sign in to comment.