-
Notifications
You must be signed in to change notification settings - Fork 49.9k
Deprecate act from react-dom/test-utils in favor of act from react
#28597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
775df84 to
2803430
Compare
| it('throws on every removed function with a special message', async () => { | ||
| expect(ReactTestUtils.isDOMComponent).toThrowError( | ||
| '`isDOMComponent` was removed from `react-dom/test-utils`. ' + | ||
| 'For testing React, we recommend React Testing Library instead: https://testing-library.com/docs/react-testing-library/intro.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the react-test-renderer warning, I don't think we should hard code the recommendations into the error message, instead something like:
isDOMComponentwas removed fromreact-dom/test-utils. See https://react.dev/warnings/react-test-renderer for more info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto for the other warning messages added here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And we can update that warning page with info on which methods were removed, and why we removed them.
42124b8 to
eed0ea4
Compare
eed0ea4 to
d9b56ba
Compare
d9b56ba to
32549cf
Compare
db27415 to
32549cf
Compare
Stacked on #28541
Summary
Use
React.actinstead:How did you test this change?
React.actnow instead ofReactDOMTestUtilswhen testing the publicact