File tree 1 file changed +22
-0
lines changed
docs/react-testing-library
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -285,3 +285,25 @@ the `RTL_SKIP_AUTO_CLEANUP` env variable to 'true'. You can do this with
285
285
```
286
286
cross-env RTL_SKIP_AUTO_CLEANUP=true jest
287
287
```
288
+
289
+ To make this even easier, you can also simply import
290
+ ` @testing-library/react/dont-cleanup-after-each ` which will do the same thing.
291
+ Just make sure you do this before importing ` @testing-library/react ` . You could
292
+ do this with Jest's ` setupFiles ` configuration:
293
+
294
+ ``` js
295
+ {
296
+ // ... other jest config
297
+ setupFiles: [' @testing-library/react/dont-cleanup-after-each' ]
298
+ }
299
+ ```
300
+
301
+ Or with mocha's ` -r ` flag:
302
+
303
+ ```
304
+ mocha -r @testing-library/react/dont-cleanup-after-each
305
+ ```
306
+
307
+ Alternatively, you could import ` @testing-library/react/pure ` in all your
308
+ tests that you don't want the ` cleanup ` to run and the ` afterEach ` won't
309
+ be setup automatically.
You can’t perform that action at this time.
0 commit comments