【问题标题】:How to generate code coverage report with jest and detox?如何使用 jest 和 detox 生成代码覆盖率报告?
【发布时间】:2018-06-03 10:48:51
【问题描述】:

我使用 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": ...
    }

我想查看合并后的代码覆盖率,应该怎么做?

【问题讨论】:

    标签: react-native npm detox


    【解决方案1】:

    我刚刚从 detox 的开发团队那里得到了一个答案,说这可能永远不可能做到

    不确定我们如何通过 Detox 添加覆盖率,因为测试不会在 node.js 中运行您的 JS 代码。相反,它命令设备和应用做一些事情,然后断言设备/模拟器上的本机视图层次结构发生了变化。

    我相信这永远不可能。

    链接-https://github.com/wix/detox/issues/470

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

    【讨论】:

      猜你喜欢
      • 2014-09-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-08
      • 1970-01-01
      • 2021-06-26
      • 2019-09-02
      • 1970-01-01
      相关资源
      最近更新 更多