Closed Jeet989 closed 1 year ago
@Jeet989 How did you resolve this issue?
@andrzej-hanusek-tg not yet. I am trying to see if I get any solution
@Jeet989
Try to with jest.config.js like below
{
"preset": "react-native",
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"],
"setupFiles": ["./node_modules/react-native-gesture-handler/jestSetup.js"],
"setupFilesAfterEnv": ["./jest-setup.js"],
"transformIgnorePatterns": ["jest-runner"],
"testTimeout": 30000,
"moduleNameMapper": {
"\\.svg": "<rootDir>/__mocks__/svgMock.js",
"^@/(.*)$": "<rootDir>/src/$1"
}
}
and jest-setup.js
import '@testing-library/jest-native/extend-expect';
require('react-native-reanimated/lib/reanimated2/jestUtils').setUpTests();
global.ReanimatedDataMock = {
now: () => Date.now(),
};
jest.mock('react-native/Libraries/EventEmitter/NativeEventEmitter');
});
Have the same problem
Try to add react-native-reanimated
to transformIgnorePatterns
in package.json
"transformIgnorePatterns": [
"node_modules/(?!(@react-native|react-native|react-native-reanimated)/)"
],
Description
Unable to run jest after installing the navigation dependency and the required other dependencies. I think so you can reproduce this issue by creating a new project as well. Here, I have also created a new project with the same issue and below is the git link.
Here is the issue screenshot:
Steps to reproduce
Just create a new project and add the react navigation dependencies. Then add the reanimated library and configure it with the proper jest files and then you will be able to get the same issue.
Snack or a link to a repository
https://github.com/Jeet989/Testing
Reanimated version
^2.14.4
React Native version
0.71.3
Platforms
Android, iOS
JavaScript runtime
None
Workflow
React Native (without Expo)
Architecture
None
Build type
None
Device
None
Device model
No response
Acknowledgements
Yes