From 70349873ec4f0059679c8ab62ebc850516a52c6d Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Sat, 10 Aug 2019 07:48:51 -0600 Subject: [PATCH 1/2] Update setup.md --- docs/react-testing-library/setup.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/react-testing-library/setup.md b/docs/react-testing-library/setup.md index 3f20048ff..3605e8d84 100644 --- a/docs/react-testing-library/setup.md +++ b/docs/react-testing-library/setup.md @@ -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 be setup and the `afterEach` wont +be setup automatically. From 7e6358c09c4acf740192fac52e1a1c1459cce1db Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Sat, 10 Aug 2019 14:29:38 -0600 Subject: [PATCH 2/2] Update docs/react-testing-library/setup.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: AdriĆ  Fontcuberta --- docs/react-testing-library/setup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/react-testing-library/setup.md b/docs/react-testing-library/setup.md index 3605e8d84..30bdf2096 100644 --- a/docs/react-testing-library/setup.md +++ b/docs/react-testing-library/setup.md @@ -305,5 +305,5 @@ 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 be setup and the `afterEach` wont +tests that you don't want the `cleanup` to run and the `afterEach` won't be setup automatically.