我使用 jest 进行单元测试,并使用 detox 进行一些自动化(使用 jest 作为测试运行程序)。这是我在 package.json
"jest": {
"preset": "react-native",
"collectCoverage": true,
"coverageReporters": [
"json",
"html"
],
"testPathIgnorePatterns": [
"/node_modules/",
"/.history/",
"/e2e/"
]
},
"detox": {
"test-runner": "jest",
"runner-config": "e2e/config.json",
"configurations": ...
}
我想查看合并的代码覆盖率,我该怎么做?
最佳答案
我刚刚得到 detox 开发团队的答复,这可能永远不可能实现
Not sure how we can add coverage by Detox since the tests don't run your JS code in node. Instead, it commands the device and the app to do stuff, and then asserts that something has changed in the native view hierarchy on the device/simulator.
I believe this will never be possible.
UDPATE:看起来像https://github.com/wix/detox/issues/470已经重新开放,人们正在积极努力使排毒测试覆盖范围成为可能!永远不要说永远:D
关于react-native - 如何使用 jest 和 detox 生成代码覆盖率报告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47913436/