SonarQube 单元测试报告不显示 Javascript 个文件
SonarQube unit test report doesnt show Javascript files
我有一个 Maven 项目,在 Java 和 Java 脚本中都有模块。
我在 SonarQube 的测试报告中没有看到 Java 脚本单元测试文件,但只有 Java 单元测试文件。
coverage_reports
在 coverage_reports
文件夹中,我有 cobertura-coverage.xml
由 Jest 创建。
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>
据我所知 sonar.javascript.jstest.reportPaths
不存在(而且从未存在过)。
有两件事(根据问题我不确定你需要哪一件):
- 单元测试报告导入(有多少单元测试、失败的、跳过的等)。为此,请参阅文档 here(您最终需要使用
sonar.testExecutionReportPaths
属性)。
- 覆盖率报告导入。如果您能够生产 LCOV,请参阅文档 here. If not, you will need to convert your report in generic SonarQube format (see here).
最后,要查看 JS 的单元测试文件,请正确设置 sonar.tests
属性(Java 由于 maven 扫描器足够智能,测试文件会显示)
我有一个 Maven 项目,在 Java 和 Java 脚本中都有模块。 我在 SonarQube 的测试报告中没有看到 Java 脚本单元测试文件,但只有 Java 单元测试文件。 coverage_reports
在 coverage_reports
文件夹中,我有 cobertura-coverage.xml
由 Jest 创建。
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>
据我所知 sonar.javascript.jstest.reportPaths
不存在(而且从未存在过)。
有两件事(根据问题我不确定你需要哪一件):
- 单元测试报告导入(有多少单元测试、失败的、跳过的等)。为此,请参阅文档 here(您最终需要使用
sonar.testExecutionReportPaths
属性)。 - 覆盖率报告导入。如果您能够生产 LCOV,请参阅文档 here. If not, you will need to convert your report in generic SonarQube format (see here).
最后,要查看 JS 的单元测试文件,请正确设置 sonar.tests
属性(Java 由于 maven 扫描器足够智能,测试文件会显示)