Jest integration broken?

I created and started building my Expo app about a month and a half ago. I’m at the stage where I need to create tests, so I was following:

Installing jest-expo works, but installing react-test-renderer breaks due to dependency issues:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: react@16.13.1
npm ERR! node_modules/react
npm ERR!   react@"16.13.1" from the root project
npm ERR!   peer react@">=16.0.0" from @testing-library/react-native@7.1.0
npm ERR!   node_modules/@testing-library/react-native
npm ERR!     dev @testing-library/react-native@"*" from the root project
npm ERR!   1 more (react-native)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"17.0.1" from react-test-renderer@17.0.1
npm ERR! node_modules/react-test-renderer
npm ERR!   peer react-test-renderer@">=16.0.0" from @testing-library/react-native@7.1.0
npm ERR!   node_modules/@testing-library/react-native
npm ERR!     dev @testing-library/react-native@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

I performed expo upgrade, which claimed I was already at the latest version but performed an upgrade (and downgrade in some cases) of my packages just to be sure, but the issue persists.

Of course, I can manually change package versions in my package.json, but that seems dubious. Thoughts?

Here’s the answer to your problem.

For better context, you should read the whole thread though really not just that one comment.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.