无法从“init.js”中找到模块“detox/runners/jest/adapter” - 排毒
Posted
技术标签:
【中文标题】无法从“init.js”中找到模块“detox/runners/jest/adapter” - 排毒【英文标题】:Cannot find module 'detox/runners/jest/adapter' from 'init.js' - Detox 【发布时间】:2018-12-21 10:30:43 【问题描述】:我正在尝试运行排毒测试并发现此错误"Cannot find module 'detox/runners/jest/adapter' from 'init.js'"
node_modules/.bin/jest e2e --config=e2e/config.json --maxWorkers=1 --testNamePattern='^((?!:ios:).)*$' FAIL e2e/firstTest.spec.js ● 测试套件运行失败
Cannot find module 'detox/runners/jest/adapter' from 'init.js' at Resolver.resolveModule (../node_modules/jest-resolve/build/index.js:191:17) at Object.<anonymous> (init.js:3:13)
测试套件:1 次失败,总共 1 次测试:总共 0 次快照:0 总时间:1.27 秒运行所有匹配 /e2e/i 的测试套件 测试匹配“^((?!:ios:).)*$”。 child_process.js:643 抛出错误; ^
错误:命令失败:node_modules/.bin/jest e2e --config=e2e/config.json --maxWorkers=1 --testNamePattern='^((?!:ios:).)*$' 在 checkExecSyncError (child_process.js:603:11) 在 Object.execSync (child_process.js:640:13) 在 runJest (/Users/neeraj.kumar/Neeraj/Projects/sampleApp/node_modules/detox/local-cli/detox-test.js:135:6) 运行时(/Users/neeraj.kumar/Neeraj/Projects/sampleApp/node_modules/detox/local-cli/detox-test.js:78:7) 在对象。 (/Users/neeraj.kumar/Neeraj/Projects/sampleApp/node_modules/detox/local-cli/detox-test.js:180:1) 在 Module._compile (internal/modules/cjs/loader.js:689:30) 在 Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) 在 Module.load (internal/modules/cjs/loader.js:599:32) 在 tryModuleLoad (internal/modules/cjs/loader.js:538:12) 在 Function.Module._load (internal/modules/cjs/loader.js:530:3)
命令:detox test -c android.emu.debug
package.json:
"name": "sampleApp",
"version": "0.0.1",
"private": true,
"scripts":
"start": "node node_modules/react-native/local-cli/cli.js start",
"test-android": "detox build --configuration android.emu.debug && detox test --configuration android.emu.debug -l verbose"
,
"dependencies":
"npm": "^6.1.0",
"react": "16.2.0",
"react-native": "0.53.3"
,
"devDependencies":
"babel-jest": "21.2.0",
"babel-plugin-transform-react-jsx-source": "^6.22.0",
"detox": "7.4.0",
"jest": "21.2.1",
"react-test-renderer": "16.0.0-beta.5"
,
"detox":
"test-runner": "jest",
"specs": "e2e",
"runner-config": "e2e/config.json",
"configurations":
"android.emu.debug":
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
"type": "android.emulator",
"name": "Nexus_5X_API_28_x86"
可能是什么问题?当我看到我的 node_module >> detox 文件夹时,我看不到 runner 文件夹。我错过了什么吗?
【问题讨论】:
【参考方案1】:将您的 detox
依赖项更新为 ^8.0.0
。
【讨论】:
感谢您的回复,由于未安装 jest/mocha runner,它没有运行。排毒依赖性没有问题。因此我的问题得到了解决。 @Neerajkumar:安装 jest/mocha runner 的步骤是什么?能给个链接吗以上是关于无法从“init.js”中找到模块“detox/runners/jest/adapter” - 排毒的主要内容,如果未能解决你的问题,请参考以下文章
Next.js:模块构建失败:错误:无法从“/home/ugurkaya/Desktop”中找到模块“react-hot-loader/babel”
开玩笑 - 无法从“source-map-support.js”中找到模块“source-map”