Skip to content

Commit 373f390

Browse files
authored
docs(no-render-in-setup): add rationale (#697)
1 parent b1eca80 commit 373f390

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/rules/no-render-in-setup.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
This rule disallows the usage of `render` (or a custom render function) in testing framework setup functions (`beforeEach` and `beforeAll`) in favor of moving `render` closer to test assertions.
1010

11+
This rule reduces the amount of variable mutation, in particular avoiding nesting `beforeEach` functions. According to Kent C. Dodds, that results in vastly simpler test maintenance.
12+
13+
For more background on the origin and rationale for this best practice, read Kent C. Dodds's [Avoid Nesting when you're Testing](https://kentcdodds.com/blog/avoid-nesting-when-youre-testing).
14+
1115
Examples of **incorrect** code for this rule:
1216

1317
```js

0 commit comments

Comments
 (0)