mirror of
https://github.com/callstack/react-native-testing-library.git
synced 2026-09-18 23:09:04 +08:00
feat: wrap waitFor in (async) act to support async queries without explicit act call (#344)
* Wrapped waitFor call in act to support async waitFor/findBy * Updated docs * Spelling mistake * Added short info in migration guide * Corrected spelling * Clarified comments * Added async act implementation conditional on React version * Code review changes * Update src/waitFor.js Co-authored-by: Michał Pierzchała <thymikee@gmail.com> * Update src/waitFor.js Co-authored-by: Michał Pierzchała <thymikee@gmail.com> * Fixed prettier * Update src/waitFor.js Co-authored-by: Michał Pierzchała <thymikee@gmail.com> Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
This commit is contained in:
committed by
Michał Pierzchała
parent
cffd31802f
commit
2b14360f28
@@ -66,6 +66,10 @@ This library has a peerDependencies listing for `react-test-renderer` and, of co
|
||||
|
||||
As you may have noticed, it's not tied to React Native at all – you can safely use it in your React components if you feel like not interacting directly with DOM.
|
||||
|
||||
:::info
|
||||
In order to properly use helpers for async tests (`findBy` queries and `waitFor`) you need at least React >=16.9.0 (featuring async `act`) or React Native >=0.60 (which comes with React >=16.9.0).
|
||||
:::
|
||||
|
||||
### Additional Jest matchers
|
||||
|
||||
In order to use addtional React Native-specific jest matchers from [@testing-library/jest-native](https://github.com/testing-library/jest-native) package add it to your project:
|
||||
|
||||
Reference in New Issue
Block a user