【问题标题】:SonarQube unit test report doesnt show Javascript filesSonarQube 单元测试报告不显示 Javascript 文件
【发布时间】:2018-11-08 03:39:22
【问题描述】:

我有一个包含 Java 和 Javascript 模块的 maven 项目。 我在 SonarQube 的测试报告中没有看到 Javascript 单元测试文件,而只有 Java 单元测试文件。 覆盖率报告

coverage_reports 文件夹中,我有由 Jest 创建的 cobertura-coverage.xml。 这个sonar.javascript.jstest.reportPaths 是否仍在使用或已被其他配置替换。我们在服务器上使用 Sonarqube 6.7。

编辑: 为了让其他人知道,我使用jest-sonar-reporter 和测试脚本作为

"test": "cross-env CI=true NODE_PATH=./src react-scripts test --env=jsdom --coverage --no-cache -u --testResultsProcessor jest-sonar-reporter"

这创建了一个我这样使用的测试报告 xml 文件

<sonar.tests>src/test</sonar.tests>
<sonar.testExecutionReportPaths>path/to/test-report.xml</sonar.testExecutionReportPaths>
<sonar.javascript.lcov.reportPaths>path/to/lcov.info</sonar.javascript.lcov.reportPaths>

【问题讨论】:

  • “我在 SonarQube 的测试报告中没有看到 Javascript 单元测试文件”是什么意思?

标签: javascript sonarqube sonarqube-scan


【解决方案1】:

据我所知,sonar.javascript.jstest.reportPaths 不存在(而且从未存在)。

有两件事(从问题我不确定你需要哪一件):

  1. 单元测试报告导入(多少单元测试,失败,跳过等)。为此,请参阅 doc here(您最终需要使用 sonar.testExecutionReportPaths 属性)。
  2. 覆盖报告导入。如果您能够生产 LCOV,请参阅 doc here。如果没有,您需要将您的报告转换为通用 SonarQube 格式(请参阅here)。

最后,要查看 JS 的单元测试文件,请正确设置 sonar.tests 属性(由于 maven 扫描仪足够智能,所以会显示 Java 测试文件)

【讨论】:

    猜你喜欢
    • 2018-09-07
    • 1970-01-01
    • 2017-11-18
    • 2019-07-07
    • 2016-10-27
    • 1970-01-01
    • 2015-05-06
    • 2016-08-24
    • 2016-03-22
    相关资源
    最近更新 更多