mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-27 03:08:06 +00:00
fix: use globalThis over global (#4448)
This commit is contained in:
@@ -227,11 +227,11 @@ When you first update your tests to use `createRoot`, you may see this warning i
|
||||
|
||||
> The current testing environment is not configured to support act(...)
|
||||
|
||||
To fix this, set `global.IS_REACT_ACT_ENVIRONMENT` to `true` before running your test:
|
||||
To fix this, set `globalThis.IS_REACT_ACT_ENVIRONMENT` to `true` before running your test:
|
||||
|
||||
```js
|
||||
// In your test setup file
|
||||
global.IS_REACT_ACT_ENVIRONMENT = true;
|
||||
globalThis.IS_REACT_ACT_ENVIRONMENT = true;
|
||||
```
|
||||
|
||||
The purpose of the flag is to tell React that it's running in a unit test-like environment. React will log helpful warnings if you forget to wrap an update with `act`.
|
||||
|
||||
Reference in New Issue
Block a user