Since React and react-test-renderer 16.9.0 we have async act. This would be super helpful in the tests to remove all the act warnings and make a few tests pass that are failing otherwise
The easiest option would just be to update react-test-renderer and then making all act calls async by default. However, I'm not sure how that would work with downwards compatibility...
Would fix #176 and #200 which are both results of async act not being available
We need some compat layer – checking whether react is at certain version or so
in the last two days, React Native updated to 0.61.1 which includes async act. Would be great if we could get it working in this library. From what I could tell, there's already an act helper file in the repo (https://github.com/callstack/react-native-testing-library/blob/master/src/act.js) that should cover the case of no act at all, however just wrapping that exported act in async should be possible without issues, right? If not, I'm happy to have a look and see if I can put together a PR.
A PR to support both regular and async act would be great!
I'm working on a RN 0.59 project; updating 0.6X is a big change and we're tackling it one step at a time.
In our proces to ditch Enzyme we started migrating to this library. For us the main reason to use this library over https://www.npmjs.com/package/@testing-library/react-native was @testing-library/react-native requires async act which is only available in the newest RN versions.
I'm really happy to see wanting to support both for now has been on your mind 👍 Having a more gradual upgrade path is really helping us out.
I would join other guys about implementation of both variants.
We have updated to latest react and RN and are waiting for supporting this feature.
Any updates on this?
Using async act won't magically fix your problems, because rendering is sync anyway and we won't await your render.
Please see this issue: https://github.com/callstack/react-native-testing-library/issues/250 and this blog post https://kentcdodds.com/blog/fix-the-not-wrapped-in-act-warning to learn how to deal with act warnings.
Most helpful comment
Using async act won't magically fix your problems, because rendering is sync anyway and we won't
awaityour render.Please see this issue: https://github.com/callstack/react-native-testing-library/issues/250 and this blog post https://kentcdodds.com/blog/fix-the-not-wrapped-in-act-warning to learn how to deal with
actwarnings.