Detox: ExpoKit: device is not defined: detox.init(config) seems to be hanging

Description

Having what seems to be a classic device is not defined error, it seems that indeed the await detox.init(config) which is located by default in the beforeAll from the init.js never completes. I surrounded it by logs, and only the first one triggers. I also tried to put it in a try/catch but it does not catch any exception. My app is detached from expo, I’m using ExpoKit 31 with RN 0.57. I’m also using jest and not mocha. I’m trying to run one single test, and the error was the same with the default first test generated by detox init.

Detox, Node, Device, Xcode and macOS Versions

  • Detox: 10.0.11
  • Expo: 31.0.4
  • ExpoKit: 31.0.2
  • React Native: 0.57
  • Node: 10.10.0
  • Device: iPhone Xs Max (Simulator)
  • Xcode: 10.1
  • macOS: Mojave 10.14.3

Device and verbose Detox logs

  ● Example › should tap login button on login screen

    ReferenceError: device is not defined

      3 |   beforeEach(async () => {
      4 |     // await reloadApp()
    > 5 |     await device.reloadReactNative()
        |           ^
      6 |   })
      7 |
      8 |   it('should tap login button on login screen', async () => {

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 8
  • Comments: 16 (3 by maintainers)

Most upvoted comments

I have same problem without expo, just react-native

I encounter the same problem as @KowalskiP.

For reference, my app has these libraries: detox: ^12.4.1 expokit: 32.1.1 expo: 32.0.0 react-native: 0.57.1 (expo sdk-32.0.0) XCode: 10.1 (10B61) macOS: Mojave 10.14.4 (18E226) node: 11.13.0

Here’s a sample repo with a status that’s failing: https://github.com/jmporchet/expokit-detox-test There are two branches, master with jest and mocha with mocha.

There’s a trace.txt that gives the output of the detox test --loglevel trace command in both branches.

What I did:

Happy to help in debugging this, hit me up here or on Twitter @jmporchet.