Cannot Run Jest

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:

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?

same issue here, is there any solution for this?

These are the changes I had to perform in my old project to get JEST working again

  1. 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"
  2. 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

And now I have my tests running again.

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