Skip to content

Commit 8b11b7d

Browse files
author
pierrezimmermann
committed
docs: update docs on custom jest preset
1 parent 1e8b3ba commit 8b11b7d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Then automatically add it to your jest tests by using `setupFilesAfterEnv` optio
7474

7575
### Custom Jest Preset
7676

77-
> **important** if you use "modern" Fake Timers
77+
> **important** if you use "modern" Fake Timers and React Native < 0.71
7878
7979
We generally advise to use the "react-native" preset when testing with this library. However, if you use ["modern" Fake Timers](https://jestjs.io/blog/2020/05/05/jest-26#new-fake-timers) (default since Jest 27), you'll need to apply our custom Jest preset or awaiting promises, like `waitFor`, will timeout.
8080

website/docs/API.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ It is also recommended to have a [single assertion per each `waitFor`](https://k
563563
### Using Jest fake timers
564564

565565
:::caution
566-
When using modern fake timers (the default for `Jest` >= 27), `waitFor` won't work (it will always timeout even if `expectation()` doesn't throw) unless you use the custom [@testing-library/react-native preset](https://github.com/callstack/react-native-testing-library#custom-jest-preset).
566+
When using modern fake timers (the default for `Jest` >= 27), `waitFor` won't work (it will always timeout even if `expectation()` doesn't throw) unless you use the custom [@testing-library/react-native preset](https://github.com/callstack/react-native-testing-library#custom-jest-preset) or you use a version of React Native >= 0.71.
567567
:::
568568

569569
`waitFor` checks whether Jest fake timers are enabled and adapts its behavior in such case. The following snippet is a simplified version of how it behaves when fake timers are enabled:

0 commit comments

Comments
 (0)