【问题标题】:Detox tests are assigned to Undefined, and all e2e are skipped排毒测试分配给未定义,所有e2e都被跳过
【发布时间】:2020-11-05 05:19:32
【问题描述】:
  1. 我在一个新的 react-native init 项目上安装了 jest 和 detox。
  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"
      }
    }
  }
}

排毒配置.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.jsdetox.init 包含在内,但同样的错误。

【问题讨论】:

  • 嘿!如果您发布后有解决方案,我很乐意听到。我和你一样在挣扎……谢谢大家
  • 我确实做到了@GuillaumeS.,结果证明0.63 不支持排毒,但几天前刚刚发布...我必须在0.62 并且运行良好!

标签: reactjs react-native jestjs detox


【解决方案1】:

在我尝试这个时,React Native 的新 0.63 版本还不支持 detox。如果你在 0.62 构建一个新项目应该没问题。我不确定这是否已经修复!

【讨论】:

  • 哦,好的,谢谢您的回答。不过这很奇怪,我仍然在 0.61.5 并且无法正常工作。到时候我会努力更新的。非常感谢!
猜你喜欢
  • 1970-01-01
  • 2018-09-21
  • 2015-11-27
  • 1970-01-01
  • 2018-04-20
  • 1970-01-01
  • 2023-01-19
  • 2020-11-11
  • 1970-01-01
相关资源
最近更新 更多