繁体   English   中英

运行“排毒测试”时找不到模块@ jest / reporters

[英]Cannot find module @jest/reporters when running 'detox test'

在我的React Native项目中获取Detox设置时遇到一些麻烦。 我的项目配置如下:

MacOS版本:10.14.14 Xcode 10.2.1命令行工具:版本10.2.1

的package.json:

{
  "name": "AppName",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "babel-preset-react-native-stage-0": "^1.0.1",
    "detox": "^12.11.0",
    "jest": "^23.6.0",
    "jest-react-native": "^18.0.0",
    "mocha": "^6.1.4",
    "react-test-renderer": "16.3.1"
  },
  "scripts": {
    "start": "react-native start",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "devtools": "react-devtools --port 8091",
    "test": "jest"
  },
  "jest": {
    "preset": "react-native"
  },
  "dependencies": {
    "jail-monkey": "^2.1.1",
    "react": "16.3.1",
    "react-devtools": "^3.2.3",
    "react-native": "~0.55.2",
    "react-native-camera": "1.1.4",
    "react-native-device-info": "^0.22.5",
    "react-native-fs": "^2.13.3",
    "react-native-image-resizer": "^1.0.0",
    "react-native-mail": "^3.0.7",
    "react-native-maps": "^0.21.0",
    "react-native-permissions": "^1.1.1",
    "react-native-signature-capture": "^0.4.9",
    "react-native-sortable-list": "0.0.22",
    "react-native-sound": "^0.10.12",
    "react-native-splash-screen": "^3.1.1",
    "react-native-sqlcipher-storage": "github:axsy-dev/react-native-sqlcipher-storage",
    "react-native-swipe-gestures": "^1.0.2",
    "react-native-swipeout": "^2.3.6",
    "react-navigation": "^2.2.4",
    "react-redux": "^5.0.7",
    "redux": "^4.0.0",
    "redux-thunk": "^2.2.0",
    "rn-fetch-blob": "^0.10.15"
  },
  "rnpm": {
    "assets": [
      "./src/assets/fonts"
    ]
  },
  "detox": {
    "configurations": {
      "ios.sim.debug": {
        "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/ProntoPOD.app",
        "build": "xcodebuild -workspace ios/ProntoPOD.xcworkspace -scheme ProntoPOD -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
        "type": "ios.simulator",
        "name": "iPhone XR"
      }
    },
    "test-runner": "jest"
  }
}

最初,按照《安装指南》中的说明安装Jest和Detox之后,出现以下错误:

生成系统信息错误:多个命令产生“:”:1)目标“双转换”(项目“ React”)具有来自“ / Users / cbrobbel / ProntoProjects / prontopod / ProntoPOD / node_modules / react-native / third-party”的复制命令/double-conversion-1.1.5/src/bignum-dtoa.h'到'/ Users / cbrobbel / ProntoProjects / prontopod / ProntoPOD / ios / build / Build / Products / Debug-iphonesimulator / include / double-conversion / bignum- dtoa.h'2)目标'double-conversion-tvOS'(项目'React')从'/ Users / cbrobbel / ProntoProjects / prontopod / ProntoPOD / node_modules / react-native / third-party / double-conversion- 1.1.5 / src / bignum-dtoa.h'到'/Users/cbrobbel/ProntoProjects/prontopod/ProntoPOD/ios/build/Build/Products/Debug-iphonesimulator/include/double-conversion/bignum-dtoa.h'

生成系统信息错误:多个命令产生“:”:1)目标“双转换”(项目“ React”):Libtool / Users / cbrobbel / ProntoProjects / prontopod / ProntoPOD / ios / build / Build / Products / Debug-iphonesimulator / libdouble-conversion.a普通的x86_64 2)目标“ double-conversion-tvOS”(项目“ React”):Libtool / Users / cbrobbel / ProntoProjects / prontopod / ProntoPOD / ios / build / Build / Products / Debug-iphonesimulator / libdouble- conversion.a普通的x86_64

**建立失败**

detox [64617]错误:[cli.js]错误:命令失败:xcodebuild -workspace ios / ProntoPOD.xcworkspace -scheme ProntoPOD -configuration调试-sdk iphonesimulator -derivedDataPath ios / build

通过将XCode中的构建系统更改为“工作区设置”下的“旧版”构建,可以解决此问题。 现在出现以下错误,我不确定如何解决:

错误:将报告程序添加到路径“ /Users/cbrobbel/ProntoProjects/prontopod/ProntoPOD/node_modules/detox/runners/jest/streamlineReporter.js”时发生错误。无法在reports.forEach中找到模块“ @ jest / reporters”( /Users/cbrobbel/ProntoProjects/prontopod/ProntoPOD/node_modules/jest/node_modules/jest-cli/build/TestScheduler.js:510:15)位于TestScheduler._addCustomReporters(/ Users / cbrobbel / ProntoProjects / prontopod)上的Array.forEach() /ProntoPOD/node_modules/jest/node_modules/jest-cli/build/TestScheduler.js:497:15)在TestScheduler._setupReporters(/ Users / cbrobbel / ProntoProjects / prontopod / ProntoPOD / node_modules / jest / node_modules / jest-cli / build / Users / cbrobbel /下的新TestScheduler(/Users/cbrobbel/ProntoProjects/prontopod/ProntoPOD/node_modules/jest/node_modules/jest-cli/build/TestScheduler.js:193:10)上的/TestScheduler.js:466:12) ProntoProjects / prontopod / ProntoPOD / node_modules / jest / node_modules / jest-cli / build / runJest.js:452:27在Generator.next()在步骤(/ Users / cbrobbel / ProntoPro 在/ Users / cbrobbel / ProntoProjects / prontopod / ProntoPOD / node_modules / jest / node_modules / jest-cli / build //中的jects / prontopod / ProntoPOD / node_modules / jest / node_modules / jest-cli / build / runJest.js:107:30)在processTicksAndRejections(内部/进程/task_queues.js:86:5)处的runJest.js:118:15 detox [64758]错误:[cli.js]错误:命令失败:node_modules / .bin / jest --config = e2e / config.json --maxWorkers = 1'--testNamePattern = ^((?!:android:)。)* $'“ e2e”

任何帮助,将不胜感激。 谢谢!

如果这是由于对等方依赖性导致的,则可以尝试手动npm install @jest/reporters ,因为对等方依赖性不会自动安装在npm 3以上。

尝试跑步

npm install @jest/reporters 
npm install

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM