Skip to content

Commit d603d3f

Browse files
committed
Clarifies cleanup docs for Vue and Preact
1 parent e1516d1 commit d603d3f

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

docs/preact-testing-library/api.mdx

+5-3
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ const {results} = render(<YourComponent />, {options})
5252

5353
Unmounts the component from the container and destroys the container.
5454

55-
📝 When you import anything from the library, this automatically runs after each
56-
test. If you'd like to disable this then set `process.env.PTL_SKIP_AUTO_CLEANUP`
57-
to true when running your tests.
55+
> This is called automatically if your testing framework (such as mocha, Jest or
56+
> Jasmine) injects a global `afterEach()` function into the testing environment.
57+
58+
If you'd like to disable this then set `process.env.PTL_SKIP_AUTO_CLEANUP` to
59+
true when running your tests.
5860

5961
```jsx
6062
import {render, cleanup} from '@testing-library/preact'

docs/vue-testing-library/api.mdx

+2-3
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,8 @@ See a working example of `update` in the
232232
Unmounts Vue trees that were mounted with
233233
[render](#rendercomponent-options-callback).
234234

235-
> If you are using an environment that supports `afterEach` hook (as in Jest),
236-
> there's no need to call `cleanup` manually. Vue Testing Library handles it for
237-
> you.
235+
> This is called automatically if your testing framework (such as mocha, Jest or
236+
> Jasmine) injects a global `afterEach()` function into the testing environment.
238237
239238
Failing to call `cleanup` when you've called `render` could result in a memory
240239
leak and tests which are not idempotent (which can lead to difficult to debug

0 commit comments

Comments
 (0)