Skip to content

Commit 52b9eed

Browse files
committed
fix setup section
1 parent 508b203 commit 52b9eed

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

versioned_docs/version-7.x/testing.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ To add the mocks, create a file `jest/setup.js` (or any other file name of your
2929
import 'react-native-gesture-handler/jestSetup';
3030

3131
// Include this section for mocking react-native-reanimated
32-
require('react-native-reanimated').setUpTests();
32+
import { setUpTests } from 'react-native-reanimated';
33+
34+
setUpTests();
3335

3436
// Silence the warning: Animated: `useNativeDriver` is not supported because the native animated module is missing
3537
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
@@ -46,12 +48,6 @@ Then we need to use this setup file in our jest config. You can add it under `se
4648

4749
Make sure that the path to the file in `setupFilesAfterEnv` is correct. Jest will run these files before running your tests, so it's the best place to put your global mocks.
4850

49-
:::info
50-
51-
Depending on the versions of React Native Reanimated and Jest you're using, mocking Reanimated might require different configuration - please refer to [the docs of Reanimated](https://docs.swmansion.com/react-native-reanimated/docs/guides/testing#setup) for details.
52-
53-
:::
54-
5551
If your configuration works correctly, you can skip this section, but in some unusual cases you will need to mock `react-native-screens` as well. To add mock of the particular component, e.g. `Screen`, add the following code in `jest/setup.js` file:
5652

5753
```js

0 commit comments

Comments
 (0)