小编Sny*_*nyp的帖子

当我运行测试时,无法从“node_modules/react-native/jest/setup.js”找到模块“@babel/runtime/helpers/interopRequireDefault”

我正在尝试使用 typescript、react-native、expo 和 jest 构建一个移动应用程序。当我尝试运行测试时:

\n
 FAIL  src/components/Button/tests/Button.test.tsx\n  \xe2\x97\x8f Test suite failed to run\n\n    Cannot find module '@babel/runtime/helpers/interopRequireDefault' from 'node_modules/react-native/jest/setup.js'\n\n      at Resolver.resolveModule (node_modules/jest-resolve/build/resolver.js:324:11)\n      at Object.<anonymous> (node_modules/react-native/jest/setup.js:407:30)\n
Run Code Online (Sandbox Code Playgroud)\n

tsconfig.json

\n
{\n    "extends": "expo/tsconfig.base",\n    "include": ["./src/**/*.ts", "./src/**/*.tsx"],\n    "exclude": [\n        "node_modules",\n        "**/*.spec.ts",\n        "**/*.test.ts",\n        "**/*.spec.tsx",\n        "**/*.test.tsx",\n        "jest.config.ts",\n        "babel.config.js",\n        "metro.config.js",\n        "stryker.conf.json"\n    ],\n    "compilerOptions": {\n        "noEmit": true,\n        "pretty": true,\n        "strict": true,\n        "allowJs": true,\n        "sourceMap": true,\n        "baseUrl": "./src",\n        "module": "es2022",\n        "target": "ES2021",\n        "declaration": true,\n        "skipLibCheck": true,\n        "jsx": "react-native",\n        "esModuleInterop": true,\n        "isolatedModules": true,\n        "noImplicitReturns": true,\n        "resolveJsonModule": true,\n        "types": …
Run Code Online (Sandbox Code Playgroud)

javascript typescript jestjs react-native ts-jest

17
推荐指数
2
解决办法
2万
查看次数

标签 统计

javascript ×1

jestjs ×1

react-native ×1

ts-jest ×1

typescript ×1