-
Notifications
You must be signed in to change notification settings - Fork 49.6k
Closed
Labels
Description
Do you want to request a feature or report a bug?
Feature/Improvement
What is the current behavior?
If there is test code that should be wrapped in act(...)
then the current warning is given:
console.error node_modules/react-dom/cjs/react-dom.development.js:506
Warning: An update to null inside a test was not wrapped in act(...).
When testing, code that causes React state updates should be wrapped into act(...):
act(() => {
/* fire events that update state */
});
/* assert on the output */
This ensures that you're testing the behavior the user would see in the browser. Learn more at https://fb.me/react-wrap-tests-with-act
When upgrading a large code base, this is basically useless.
What is the expected behavior?
Provide at least the test name if not the line number of code that triggered the warning.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
danielkcz, Pau1fitz, worc, pouriaMaleki, nelsieborja and 104 more