-
Notifications
You must be signed in to change notification settings - Fork 273
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
act does not support async callback #176
Comments
I have just tried to update the dependencies to:
which solves the issue and enables the |
Yup, but it's still not yet supported by RN. Hopefully you won't mind me closing this issue. Thanks for reporting and coming back! |
For now I am using the |
@callstack-team I decided to post this message as my Pull-Request https://github.com/fabriziobertoglio1987/react-native-task/pull/5 and commits are referencing this issue I experienced this problem. async function fetchRows() {
const result = await fetchRowsFromApi(param);
} This solution worked in my case:
test('renders lists', async () => {
// ...
await act(async () => {
await fireEvent.changeText(searchInput, "f")
});
} |
Versions
Description
Unable to use async function as
act
callback without console errors.Either a console.error is emitted when not using
act
in the test (see Demo 1)or the test fails by using async callback in
act
(see Demo 2)Now supported in
react-testing-library
:https://github.com/testing-library/react-testing-library/releases/tag/v6.1.0
Demo 1 (not wrapping in
act
)Emits console error:
Demo 2 (wrapping with
act
-> test failure)test failure with error:
The text was updated successfully, but these errors were encountered: