本文介绍了React Native - JEST:没有找到 haste.hasteImplModulePath 选项中的 react-native/jest/hasteImpl.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在基于 expo.io 的 react 本机应用程序上实现 jest遵循实施说明后,我已经能够成功通过系统上的笑话测试

I am implementing jest on a react native application based on expo.ioAfter following the implementation notes I have been able to successfully pass the jest tests on my system

问题在于 bitbucket 管道.我遇到以下问题,管道失败

The issue is with bitbucket pipelines. I get the following issue and the pipeline gets failed

npx jest --ci
● Validation Error:
  Module react-native/jest/hasteImpl.js in the haste.hasteImplModulePath option was not found.
     <rootDir> is: /opt/atlassian/pipelines/agent/build

以下是我在 package.json 文件中的笑话配置

The following is my jest config in the package.json file

"jest": {
    "preset": "jest-expo"
},
"devDependencies": {
    "babel-jest": "^23.6.0",
    "babel-preset-react-native": "^4.0.1",
    "expo-cli": "^2.4.3",
    "enzyme": "3.3.0",
    "enzyme-adapter-react-16": "1.1.1",
    "jest": "^23.6.0",
    "jest-expo": "^31.0.0",
    "jest-react-native": "^18.0.0",
    "react-test-renderer": "^16.6.3"

}

谁能告诉我如何解决这个问题?

Can someone please let know how can i resolve this issue?

应用程序和测试工作正常.但它的管道失败了!

The application and tests work fine. But its the pipeline which gets failed!

推荐答案

我遇到了这个问题并将 jest-expo^31.0.0" 降级为 ~29.0.0,它又开始工作了.

I had this issue and downgraded jest-expo from ^31.0.0" to ~29.0.0 and it started working again.

这篇关于React Native - JEST:没有找到 haste.hasteImplModulePath 选项中的 react-native/jest/hasteImpl.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 07:02