react-native - 如何使用 jest 和 detox 生成代码覆盖率报告?

标签 react-native npm 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.

link- https://github.com/wix/detox/issues/470

UDPATE:看起来像https://github.com/wix/detox/issues/470已经重新开放,人们正在积极努力使排毒测试覆盖范围成为可能!永远不要说永远:D

关于react-native - 如何使用 jest 和 detox 生成代码覆盖率报告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47913436/

相关文章:

javascript - 原生基础输入的 Formik 验证

angular - 为什么我突然得到 : ng : File C:\Users\d\AppData\Roaming\npm\ng. ps1 无法加载

node.js - 如何以编程方式启动/停止 Metro Bundler

npm - 按关键字和作者查找 NPM 包

android - 找不到 com.wix :detox:+ 的任何匹配项

jestjs - 排毒:App没有响应下面的网络请求

react-native - React Native 弹出菜单移动选项框

android - Firebase AdMob 警告 : 'the ad request was successful but no ad was returned due to lack of ad inventory'

javascript - 测量 React Native 应用程序中网络套接字使用的带宽

node.js - webpack --watch && http-server ./dist -p 8080 --cors -o 不起作用