本文介绍了排毒测试已分配给“未定义",并且所有e2e都将被跳过的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

我的.detoxrc.json文件:

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

排毒config.json

detox 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.jsdetox.init包括在内,但存在相同的错误.

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

推荐答案

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

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!

这篇关于排毒测试已分配给“未定义",并且所有e2e都将被跳过的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-07 11:56