Skip to content

Update setup.md #215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions docs/react-testing-library/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,25 @@ the `RTL_SKIP_AUTO_CLEANUP` env variable to 'true'. You can do this with
```
cross-env RTL_SKIP_AUTO_CLEANUP=true jest
```

To make this even easier, you can also simply import
`@testing-library/react/dont-cleanup-after-each` which will do the same thing.
Just make sure you do this before importing `@testing-library/react`. You could
do this with Jest's `setupFiles` configuration:

```js
{
// ... other jest config
setupFiles: ['@testing-library/react/dont-cleanup-after-each']
}
```

Or with mocha's `-r` flag:

```
mocha -r @testing-library/react/dont-cleanup-after-each
```

Alternatively, you could import `@testing-library/react/pure` in all your
tests that you don't want the `cleanup` to run and the `afterEach` won't
be setup automatically.