Browse Source

fix: use `globalThis` over `global` (#4448)

main
Simen Bekkhus 3 years ago
committed by GitHub
parent
commit
b13640a8fb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      content/blog/2022-03-08-react-18-upgrade-guide.md

4
content/blog/2022-03-08-react-18-upgrade-guide.md

@ -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`.

Loading…
Cancel
Save