Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

RN57.3 - ReferenceError: device is not defined #1006

Closed
calcazar opened this issue Oct 29, 2018 · 1 comment
Closed

RN57.3 - ReferenceError: device is not defined #1006

calcazar opened this issue Oct 29, 2018 · 1 comment

Comments

@calcazar
Copy link

Description

We updated our RN version to 57.3 and we are no longer able to run detox tests for iOS. Every time we run tests we get the following errors:

ReferenceError: device is not defined
ReferenceError: element is not defined

detox[44535] ERROR: [index.js/DETOX_INIT_ERROR]
Error: Can't send a message on a closed websocket, init the by calling 'open()'. Message: {"type":"isReady","params":{},"messageId":-1000}

Aside from these errors, running detox test results in detox opening various simulators at once

Detox, Node, Device, Xcode and macOS Versions

  • Detox: 9.0.4
  • React Native: 0.57.3
  • Node: 9.8.0
  • Device: Any Iphone
  • Xcode: 10
  • macOS: High Sierra
@calcazar
Copy link
Author

calcazar commented Oct 29, 2018

I was able to fix this. At some point in a long chain of commitments we butchered the init.js to look like:

require('babel-polyfill');
const detox = require("detox");
const config = require("../package.json").detox;

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

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

This of course causes a ton of issues since it's supposed to be like so:

const detox = require('detox');
const config = require('../package.json').detox;
const adapter = require('detox/runners/jest/adapter');

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

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

beforeEach(async function() {
  await adapter.beforeEach();
});

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

@lock lock bot locked as resolved and limited conversation to collaborators Nov 1, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant