排毒测试已分配给“未定义”,所有e2e都将被跳过

时间:2020-07-15 16:25:54

标签: reactjs react-native jestjs detox

  1. 我在一个新的react-native init项目上安装了笑话和排毒程序。
  2. 根据排毒文档安装jest和jest-circus
  3. 设置iOS构建并测试配置
  4. 在新版本中始终出现以下错误

我的.detoxrc.json文件:

{
  "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"
      }
    }
  }
}

排毒config.json

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

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;

我尝试将包含init.js的{​​{1}}包括在内,但错误相同。

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)

在我尝试此操作时,React Native的最新0.63版本尚不支持排毒。如果您以0.62的价格建立一个新项目,那应该没问题。我不确定这是否已解决!