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: __tests__/README.md
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
-
## React Testing Library
1
+
## React Testing Library notes
2
2
3
-
Heads-up: Currently we are using `@testing-library/react/pure` instead of `@testing-library/react` since our tests are not [isolated](https://kentcdodds.com/blog/test-isolation-with-react).
3
+
### Cleanup
4
+
5
+
Currently we are using `@testing-library/react/pure` instead of `@testing-library/react` since our tests are not [isolated](https://kentcdodds.com/blog/test-isolation-with-react).
4
6
5
7
On writing new tests, please keep the `cleanup` functions in __separate__ repeating or one-time functions like `afterEach` or `afterAll`.
6
8
Otherwise, it will lose the scope of the `document`, and it won't be able to clear the `body`.
@@ -22,3 +24,7 @@ GOOD
22
24
clearIntervalSpy.restore();
23
25
});
24
26
```
27
+
28
+
### Act
29
+
30
+
Ignore the warnings about [act](https://reactjs.org/docs/test-utils.html#act) and do not wrap state mutations inside it. It is a useful helper for vanilla React state but it creates falsely passing tests for React Easy State - as it batches `setState`s.
0 commit comments