0
votes

I am trying to run Detox test and found this error "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 ● Test suite failed to run

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)

Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total Time: 1.27s Ran all test suites matching /e2e/i with tests matching "^((?!:ios:).)*$". child_process.js:643 throw err; ^

Error: Command failed: node_modules/.bin/jest e2e --config=e2e/config.json --maxWorkers=1 --testNamePattern='^((?!:ios:).)*$' at checkExecSyncError (child_process.js:603:11) at Object.execSync (child_process.js:640:13) at runJest (/Users/neeraj.kumar/Neeraj/Projects/sampleApp/node_modules/detox/local-cli/detox-test.js:135:6) at run (/Users/neeraj.kumar/Neeraj/Projects/sampleApp/node_modules/detox/local-cli/detox-test.js:78:7) at Object. (/Users/neeraj.kumar/Neeraj/Projects/sampleApp/node_modules/detox/local-cli/detox-test.js:180:1) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3)

Command : 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"
      }
    }
  }
}

What could be the Problem? When I see my node_module >> detox folder, I could not see runner folder. Did I miss something?

1

1 Answers

1
votes

Update your detox dependency to ^8.0.0.