Skip to content

Commit 4d2345b

Browse files
committed
review suggestions
1 parent b0d022f commit 4d2345b

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -267,17 +267,17 @@ await expect(snapshotStream).toRerender()
267267
268268
## Usage side-by side with `@testing-library/react` or other tools that use `act` or set `IS_REACT_ACT_ENVIRONMENT`
269269
270-
This library should not be used with `act`, and it will throw an error if `IS_REACT_ACT_ENVIRONMENT` is `true`
271-
throw an error if `IS_REACT_ACT_ENVIRONMENT` is `true`.
272-
273-
React Testing Library sets `IS_REACT_ACT_ENVIRONMENT` to `true`
274-
globally, and wraps some helpers like `userEvent.click` in `act` calls.
270+
This library should not be used with `act`, and it will throw an error if
271+
`IS_REACT_ACT_ENVIRONMENT` is `true`.
275272
273+
React Testing Library sets `IS_REACT_ACT_ENVIRONMENT` to `true` globally, and
274+
wraps some helpers like `userEvent.click` in `act` calls.
276275
To use this library side-by-side with React Testing Library, we ship the
277276
`disableActEnvironment` helper to undo these changes temporarily.
278277
279-
It returns a `Disposable` and can be used together with the `using` keyword to
280-
automatically clean up once the scope is left:
278+
It returns a `Disposable` and can be used together with the
279+
[`using` keyword](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management)
280+
to automatically clean up once the scope is left:
281281
282282
```ts
283283
test('my test', () => {
@@ -290,7 +290,8 @@ test('my test', () => {
290290
```
291291
292292
If you cannot use `using`, you can also manually call the returned `cleanup`
293-
function:
293+
function. We recommend using `finally` to ensure the act environment is cleaned
294+
up if your test fails, otherwise it could leak between tests:
294295

295296
```ts
296297
test('my test', () => {

0 commit comments

Comments
 (0)