-
Notifications
You must be signed in to change notification settings - Fork 46.5k
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
Bug: unexpected Warning: ReactDOMTestUtils.act
is deprecated in favor of React.act
.
#29000
Comments
You should bump the installed version of |
npm install --save-dev @testing-library/react resolved this issue for me. |
My issue also got resolved. Thanks a lot @Jacobmrose. |
you made my day, thanks @Jacobmrose |
@eps1lon We still see this issue. The version of @testing-library/react: ^15.0.7 |
Unfortunately, there's nothing we can do here. If something is using |
- kept getting: `Warning: ReactDOMTestUtils.act is deprecated in favor of React.act` - found a fix that recommended version bumping: facebook/react#29000 - no issues after build & clean so hopefully this doesn't cause any transitive dep issues
@sorinpav Your testing framework should add a callstack to the console.error which should help you identify where the wrong |
@eps1lon thanks for the reply. There are no instances of |
@rickhanlonii understood. Just saw your comment now. (I'm on mobile and it was harder to see) |
Just checked now, and we are on react / react-dom:^18.3.1, but I think I know what is causing it. We're unfortunately still using the enzyme react 17 adapter. Our test codebase is split in between React Testing Library and Enzyme still (long migration process), and I've just spotted that the enzyme react 17 adapter still uses the old import destination. Posting this more for others that discover this same issue. For now, I don't think it needs reopening. Thanks guys for the help! |
I was getting the same warning message while using @testing-library/react ( I updated import { act } from '@testing-library/react' |
Updating worked for me |
Thanks It's worked |
ran into the same issue - thanks @Jacobmrose! running
fixed it for me |
I didn't use
act
inreact-dom/test-utils
but I got the following warning :Warning:
ReactDOMTestUtils.act
is deprecated in favor ofReact.act
. Importact
fromreact
instead ofreact-dom/test-utils
. See https://react.dev/warnings/react-dom-test-utils for more info.React version:18.3.1
Steps To Reproduce
1.run
npx create-react-app test --template typescript
2.run
cd test
3.run
npm run test
4.press
a
The text was updated successfully, but these errors were encountered: