我尝试将mocha-jenkins-reporter
的结果集成到SonarQube。构建脚本运行以下命令:
set "JUNIT_REPORT_PATH=report.xml"
set "JENKINS_REPORTER_ENABLE_SONAR=true"
set "JENKINS_REPORTER_TEST_DIR=tests"
call npm run test-jenkins
命令完成后,我会看到一个新文件report.xml
。但是从这一点上,我不知道如何将其集成到SonarQube中。 mocha-jenkins-reporter
的描述在这里不是很有帮助(摘自https://www.npmjs.com/package/mocha-jenkins-reporter):
SonarQube is a popular tool for continuous inspection of code quality. You can find
documentation for JavaScript language on JavaScript Plugin page.
One aspect of SonarQube analysis is outcome of unit tests. To properly display test results
environment variable JENKINS_REPORTER_ENABLE_SONAR must be set to true. By default reporter
looks for tests in ./test directory. It can be changed using environment variable
JENKINS_REPORTER_TEST_DIR and providing relative path to the directory with tests.
我认为我必须更改sonar-project.properties
,但是我找不到任何有用的信息。