expo: [jest-expo] TypeError: Cannot read property 'current' of undefined , ^34.0.0
I just installed a fresh version of React Native using Expo.
npm install -g expo-cli expo init AwesomeProject cd AwesomeProject npm test
but tests fail.

I checked that versions mismatching
Versions installed are:
- jest-expo@34.0.0
- jest@24.8.0
- react-test-renderer@16.9.0
- react@16.8.3
react and react-test-renderer minor version are different, so I thought that the problem was that.
I tryed to follow the guide here:
https://docs.expo.io/versions/latest/guides/testing-with-jest/
but using npm i react-test-renderer --save-dev
always installed ^16.9 version of react-test-renderer.
So I tryed to force install ^16.8 react-test-renderer version:
npm i react-test-renderer@16.8 --save-dev
that solved the problem, but I think that there is a problem in version packages dependencies
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 7
- Comments: 23 (6 by maintainers)
also needed
react-dom@16.8.3
in my case.Moreover, both
react-dom
&react-test-renderer
needed to be exact versions (--save-exact
)@Nodirbek3d react-dom & react-test-renderer should to be exact versions (–save-exact) (without ^)
I guess It might occurs due to the expo-cli version. I got this error after upgrading expo-cli to 3.0.9
As a workaround you can downgrade the version to 3.0.8 and try…
Also there are version mismatch between the libraries for react,react-dom and react-test-renderer All needs to be in same version. these version solve my issue. “react”: “16.8.6”, “react-dom”: “16.8.6”, “react-test-renderer”: “16.8.6”,
I was getting the error with these versions:
“react”: “16.8.6”, “react-dom”: “16.8.6”, “react-test-renderer”: “^16.8.6”, <<— caret
Removed the caret on react-test-renderer so that all 3 were locked, fixed the issue.