-
Notifications
You must be signed in to change notification settings - Fork 1.1k
render
does not await act()
#1385
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I see that there's already a PR for it: #1214 |
It's a fake Promise. Only if you pass in an |
|
@eps1lon I wonder if you still disagree with the need to |
I don't disagree. That's exactly what I'm already working on: #1214 It's just that the current You do need the async version when you use |
Anyway, I hope this will be resolved. |
@testing-library/react
version: 16.2.0@vitest/browser
Relevant code or config:
What you did:
I use
use(promise)
in components.What happened:
I get the following error when rendering via
@testing-library/react
'srender()
.The test also fails:
Reproduction:
See "Relevant code or config" above.
Adding an un-awaited
act
manually does not resolve the issue either:Problem description:
I should never get any act warnings when using
@testing-library/react
functions.Suggested solution:
As the warning explicitly advises, awaiting the
act
call fixes the warning/test:AFAICT, in React 19,
act
always returns a promise, so it may be best to alwaysawait
it.Fixing the issue would make
render
async, which may be a breaking change.https://github.com/testing-library/react-testing-library/blob/main/src/pure.js#L149
The text was updated successfully, but these errors were encountered: