【发布时间】:2020-11-05 05:19:32
【问题描述】:
- 我在一个新的
react-native init项目上安装了 jest 和 detox。 - 按照排毒文档安装 jest 和 jest-circus
- 设置 iOS 构建和测试配置
- 在新版本中始终出现以下错误
我的 .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.js 与 detox.init 包含在内,但同样的错误。
【问题讨论】:
-
嘿!如果您发布后有解决方案,我很乐意听到。我和你一样在挣扎……谢谢大家
-
我确实做到了@GuillaumeS.,结果证明
0.63不支持排毒,但几天前刚刚发布...我必须在0.62 并且运行良好!
标签: reactjs react-native jestjs detox