Jest failed after upgrade to react-native 0.64
See original GitHub issueDescribe the bug
Recently I upgraded my project to 0.64 version and faced this issue when I run jest. The same error happened even after I tried with a fresh react-native project with package react-navigation
.
type ErrorHandler = (error: mixed, isFatal: boolean) => void;
^^^^^^^^^^^^
SyntaxError: Unexpected identifier
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)
at Object.<anonymous> (node_modules/react-native/jest/setup.js:439:6)
Expected behavior
Jest should be completed without error.
Steps to Reproduce
- react-native init
- install all the
react-navigation
packages - set up the testing environment as documented. (https://callstack.github.io/react-native-testing-library/docs/react-navigation#setting-up-the-test-environment)
- run jest
Screenshots
Versions
Please help. Thanks in advance 🙏🏿
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Jest failed after upgrade to react-native 0.64 Code Example
Jest failed after upgrade to react-native 0.64 ... node_modules/react-native-gesture-handler/jestSetup.js" ], "moduleFileExtensions": [ "ts" ...
Read more >Unable to upgrade ReactNative from version 0.59.x to the ...
I am upgrading it to the version, 0.64.2. I run the following command in the project's root directory. npx react-native upgrade.
Read more >React Native Upgrade Helper
Check out Upgrade Support if you are experiencing issues related to React Native during the upgrading process. Keep in mind that RnDiffApp and...
Read more >Using TypeScript - React Native
If the above command is failing, you may have an old version of react-native or react-native-cli installed globally on your system. To fix...
Read more >React Native Testing Library - npm
This is a known issue. It happens because React Native's Jest preset overrides native Promise. Our preset restores it to defaults, which is...
Read more >Top Related Medium Post
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Check the path to the file that has unsupported syntax (
type
keyword), it’s the most important one. It points to a file located insidenode_modues/@react-native/
. So, you’ll need to add@react-native
next to@react-navigation
in thetransformIgnorePatterns
config.Would you like to contribute a fix to the docs? 😃
ahh okay, replaced with
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
works 👍🏿