@@ -267,17 +267,17 @@ await expect(snapshotStream).toRerender()
267
267
268
268
## Usage side-by side with ` @testing- library/ react` or other tools that use ` act` or set ` IS_REACT_ACT_ENVIRONMENT `
269
269
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 ` .
275
272
273
+ React Testing Library sets ` IS_REACT_ACT_ENVIRONMENT ` to ` true ` globally, and
274
+ wraps some helpers like ` userEvent .click ` in ` act` calls.
276
275
To use this library side-by-side with React Testing Library, we ship the
277
276
` disableActEnvironment` helper to undo these changes temporarily.
278
277
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:
281
281
282
282
` ` ` ts
283
283
test (' my test' , () => {
@@ -290,7 +290,8 @@ test('my test', () => {
290
290
```
291
291
292
292
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:
294
295
295
296
``` ts
296
297
test (' my test' , () => {
0 commit comments