如何使用 jest 和 detox 生成代码覆盖率报告?
How to generate code coverage report with jest and detox?
我使用 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 已经重新开放,人们正在积极努力使 Detox 测试覆盖范围成为可能!永不言败 :D
我使用 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 已经重新开放,人们正在积极努力使 Detox 测试覆盖范围成为可能!永不言败 :D