Skip to content

Commit

Permalink
fix: use globalThis over global (#4448)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB authored Mar 14, 2022
1 parent 90ae846 commit b13640a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions content/blog/2022-03-08-react-18-upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down

0 comments on commit b13640a

Please sign in to comment.