有没有人能告诉我react本地排毒测试的模拟文件是怎么回事?我关注this article
我使用的是react-native版本0.57.7和detox 9.1.2
我在根目录中创建了rn-cli.config.js
const defaultSourceExts = require('metro-config/src/defaults/defaults').sourceExts
module.exports = {
resolver: {
sourceExts: process.env.RN_SRC_EXT
? process.env.RN_SRC_EXT.split(',').concat(defaultSourceExts)
: defaultSourceExts
}
};我在带有e2e扩展名的生产文件旁边创建了模拟文件

然后我用命令运行Metro (我使用的是windows powershel 6)
$env:RN_SRC_EXT="e2e.ts";react-native start
react-native run-android什么都没有,从字面上讲没有什么改变/嘲笑
我还尝试了构建和运行detox。
cd android;$env:ENVFILE="../config/default/env";gradle assembleDebug assembleAndroidTest -DtestBuildType=debug;cd ..
detox test -c android.emu.debug.win但也没有发生任何事情,我删除了所有的node_modules,安卓构建文件夹,但没有任何影响。
我错过了什么吗?
发布于 2019-06-13 18:54:50
您的rn-cli.config.js文件是正确的,但请尝试在您的排毒e2e/config.json中添加此文件
"testMatch": ["**/__tests__/**/*.js?(x)", "**/?(*.)(e2e).js?(x)"]我的是这样的:
{
"setupFilesAfterEnv": ["./init.js"],
"testEnvironment": "node",
"reporters": ["detox/runners/jest/streamlineReporter"],
"testMatch": ["**/__tests__/**/*.js?(x)", "**/?(*.)(e2e).js?(x)"],
"verbose": true
}我使用的是react-native版本0.59.8和detox 12.10.2
因为您正在使用typescript,然后编写
"testMatch": ["**/__tests__/**/*.ts?(x)", "**/?(*.)(e2e).ts?(x)"],使用ts扩展
https://stackoverflow.com/questions/55223923
复制相似问题