After running a plain expo init following the normal website instructions, and after following the additional Jest instructions here, I am getting the following error when running yarn test:
● Validation Error:
Module react-native/jest/hasteImpl.js in the haste.hasteImplModulePath option was not found.
Configuration Documentation:
https://jestjs.io/docs/configuration.html
I can confirm that in node_modules installed version of React Native there indeed isn’t any jest/hasteImpl.js file.
Any ideas? How else to people normally set up Jest with a new project?
These are the changes I had to perform in my old project to get JEST working again
I had to modify the script to launch the tests
“test:once”: “jest src”, //previously was using "node node_modules/jest/bin/jest.js src"
The code inside jest-expo has to be transpiled, then I had to add this to jest configuration
"jest": {
"preset": "jest-expo",
"setupTestFrameworkScriptFile": "<rootDir>/src/setupTests.js",
"transformIgnorePatterns": [
"node_modules/(?!(.*expo.*|.*react.*)/)" <--- to indicate the modules to be transpiled
],