declare var beforeAll: (callback: () => void) => void;
declare var beforeEach: (callback: () => void) => void;
declare var afterAll: (callback: () => void) => void;

import defaultDetox from "detox";
import adapter from "detox/runners/jest/adapter";

// Normally the Detox configuration from the project's package.json like so:
// const config = require("./package.json").detox;
declare const config: any;

declare const jasmine: any;
jasmine.getEnv().addReporter(adapter);

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

    const initOptions: Detox.DetoxInitOptions = {
        initGlobals: false,
        launchApp: false,
    };
    await defaultDetox.init(config, initOptions);
});

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

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

declare var beforeAll: (callback: () => void) => void;
declare var beforeEach: (callback: () => void) => void;
declare var afterAll: (callback: () => void) => void;

import adapter from "detox/runners/jest/adapter";

// Normally the Detox configuration from the project's package.json like so:
// const config = require("./package.json").detox;
declare const config: any;

declare const jasmine: any;
jasmine.getEnv().addReporter(adapter);

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

    const initOptions: Detox.DetoxInitOptions = {
        initGlobals: false,
        launchApp: false,
    };
    await detox.init(config, initOptions);
});

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

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

--- 
+++ 
@@ -2,6 +2,7 @@
 declare var beforeEach: (callback: () => void) => void;
 declare var afterAll: (callback: () => void) => void;
 
+import defaultDetox from "detox";
 import adapter from "detox/runners/jest/adapter";
 
 // Normally the Detox configuration from the project's package.json like so:
@@ -18,7 +19,7 @@
         initGlobals: false,
         launchApp: false,
     };
-    await detox.init(config, initOptions);
+    await defaultDetox.init(config, initOptions);
 });
 
 beforeEach(async () => {
[detox] Add test for importing default export
