question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup() with RN 0.63.3

See original GitHub issue

Describe the bug

DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup() with RN 0.63.3

I get this Detox Init error when I run Android Tests. Things used to work when I was still with RN 0.62.2. The app launched successfully in the emulator and I am able to interact with it. It’s just that the tests itself does not run.

To Reproduce

  • I have tested this issue on the latest Detox release and it still reproduces

I ran detox build --configuration android.emu.debug && detox test --configuration android.emu.debug --take-screenshots failing --loglevel verbose --debug-synchronization 10000 My package.json config

"detox": {
  "configurations": {
    "android.emu.debug": {
      "binaryPath": "android/app/build/outputs/apk/d/debug/app-d-debug.apk",
      "build": "cd android && ./gradlew assembleDDebug assembleDDebugAndroidTest -DtestBuildType=debug && cd ..",
      "type": "android.emulator",
      "name": "Nexus5X_API_29"
    },
    "android.emu.release": {
      "binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
      "build": "cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..",
      "type": "android.emulator",
      "name": "Nexus5X_API_29"
    }
  }

My init.js

import detox from "detox";
import config from "../package.json";
import adapter from "detox/runners/jest/adapter";
import specReporter from "detox/runners/jest/specReporter";
import polyfill from "babel-polyfill";

// Set the default timeout
jest.setTimeout(120000);
jasmine.getEnv().addReporter(adapter);

// This takes care of generating status logs on a per-spec basis. By default, jest only reports at file-level.
// This is strictly optional.
jasmine.getEnv().addReporter(specReporter);

beforeAll(async () => {
  await detox.init(config.detox);
});

beforeEach(async () => {
  await adapter.beforeEach();
});

afterAll(async () => {
  await adapter.afterAll();
  await detox.cleanup();
});

Expected behavior Tests to start running

Screenshots

Device and Verbose Detox Logs

detox[73943] ERROR: [DetoxExportWrapper.js/DETOX_INIT_ERROR]
 DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()

HINT: Most likely, your test runner is tearing down the suite due to the timeout error
    at Detox.[_assertNoPendingInit] (/Users/censoredusername/Documents/projects/censored-mobile-app/node_modules/detox/src/Detox.js:204:9)
    at Detox.beforeEach (/Users/censoredusername/Documents/projects/censored-mobile-app/node_modules/detox/src/Detox.js:111:37)
    at DetoxExportWrapper.<computed> (/Users/censoredusername/Documents/projects/censored-mobile-app/node_modules/detox/src/DetoxExportWrapper.js:87:32)
    at DetoxAdapterImpl.beforeEach (/Users/censoredusername/Documents/projects/censored-mobile-app/node_modules/detox/runners/jest/DetoxAdapterImpl.js:17:22)
    at DetoxAdapterJasmine.beforeEach (/Users/censoredusername/Documents/projects/censored-mobile-app/node_modules/detox/runners/jest/DetoxAdapterJasmine.js:19:5) {
  name: 'DetoxRuntimeError'
}

Environment (please complete the following information):

  • Detox: 17.3.3 and also tried latest 17.10.2
  • React Native: 0.63.3
  • Node: 12.14.0
  • Device: Android SDK 29
  • OS: MacOS 10.14.6
  • Test-runner: jest-jasmine2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

6reactions
hxiongtwcommented, Oct 19, 2020

Seem to be running fine now, closing this.

1reaction
hamzahayatcommented, Mar 10, 2021

Detox is extremely unreliable and flaky. I’ve configured everything correctly as per the documentations, and I constantly run into this error (along with a couple others) when running my tests via CI.

Some real effort needs to go into stabilizing the testing platform.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Detox launches emulator but can't install the app on it ...
Detox launches emulator but can't install the app on it afterwards: DetoxRuntimeError: Aborted detox.init() execution, and now running detox.
Read more >
Dealing With Problems With Running Tests | Detox
This page is about issues related to executing your Detox tests, typically triggered when running detox test (and not detox build, for example)....
Read more >
DetoxRuntimeError: Detox instance has not been initialized
Here is the log that I always get: detox[12731] INFO: [test.js] configuration="ios.sim.release" cleanup=true debugSynchronization=2…
Read more >
React Native end-to-end testing with Detox - LogRocket Blog
Demo running end-to-end tests in React Native with Detox, an end-to-end framework for mobile apps developed by Wix.
Read more >
Setting Up Detox - ReactNativeTesting.io
These instructions will cover setting up Detox with React Native CLI. Detox does not ... Now, initialize Detox in your app to get...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found