Detox tests are assigned to Undefined, and all e2e are skipped

痴心易碎 提交于 2021-01-28 05:45:43

问题


  1. I installed jest and detox on a fresh react-native init project.
  2. Install jest and jest-circus as per detox docs
  3. Setup iOS build and test configuration
  4. Get the following error consistently on new builds

my .detoxrc.json file:

{
  "testRunner": "jest",
  "runnerConfig": "e2e/config.json",
  "configurations": {
    "ios": {
      "type": "ios.simulator",
      "build": "xcodebuild -workspace ios/rndetox.xcworkspace -scheme rndetox -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
      "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/rndetox.app",
      "device": {
        "type": "iPhone 11"
      }
    },
    "android": {
      "type": "android.emulator",
      "binaryPath": "SPECIFY_PATH_TO_YOUR_APP_BINARY",
      "device": {
        "avdName": "Pixel_2_API_29"
      }
    }
  }
}

detox config.json

{
    "testEnvironment": "./environment",
    "testRunner": "jest-circus/runner",
    "testTimeout": 120000,
    "testRegex": "\\.e2e\\.js$",
    "reporters": ["detox/runners/jest/streamlineReporter"],
    "verbose": true
}

and e2e/environment.js

const {
  DetoxCircusEnvironment,
  SpecReporter,
  WorkerAssignReporter,
} = require('detox/runners/jest-circus');

class CustomDetoxEnvironment extends DetoxCircusEnvironment {
  constructor(config) {
    super(config);

    // Can be safely removed, if you are content with the default value (=300000ms)
    this.initTimeout = 300000;

    // This takes care of generating status logs on a per-spec basis. By default, Jest only reports at file-level.
    // This is strictly optional.
    this.registerListeners({
      SpecReporter,
      WorkerAssignReporter,
    });
  }
}

module.exports = CustomDetoxEnvironment;

I have tried including an init.js with a detox.init but same error.


回答1:


At the time I tried this, detox was not supported yet on the fresh 0.63 release of React Native. If you build a new project at 0.62 it should be fine. I am not sure if this has been fixed yet though!



来源:https://stackoverflow.com/questions/62919444/detox-tests-are-assigned-to-undefined-and-all-e2e-are-skipped

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!