feat: Enable "missing act" warnings in React 18 by default#994
feat: Enable "missing act" warnings in React 18 by default#994eps1lon merged 2 commits intotesting-library:alphafrom
Conversation
bf13638 to
565a073
Compare
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 3c5c261:
|
Codecov Report
@@ Coverage Diff @@
## alpha #994 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 4 4
Lines 226 233 +7
Branches 46 47 +1
=========================================
+ Hits 226 233 +7
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
The warning is a pretty important part of the migration story to understand why certain tests might start failing or at least excibit different behavior. At least with React 18 users are able to disable the "missing act" warning if they truly want to so this change should be fairly safe. The only issue might if people reset their modules in |
|
🎉 This PR is included in version 13.0.0-alpha.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
For anyone else finding this and wondering what the |
What:
Enables "missing act" warnings in React 18 for test runners that implement
beforeAllandafterAll(e.g. Jest).This can be disabled the same way auto-cleanup can be disabled.
Why:
Ensures same behavior regarding missing act warnings across as React 16 and 17
How:
Set
IS_REACT_ACT_ENVIRONMENTto true once before tests start.Checklist:
[ ]Documentation added to thedocs site Will wait until React docs for IS_REACT_ACT_ENVIRONMENT are available.
[ ]TypeScript definitions updated