[英]Is there a way to bring number of unit tests under coverage in Sonarqube report for Angular-Jest project?
I have run sonar for Angular-Jest project and got the unit test coverage but am not getting number of unit tests.我已经为 Angular-Jest 项目运行声纳并获得了单元测试覆盖率,但没有获得单元测试的数量。
My Sonar properties,(sonarqube version - 7.7)我的声纳属性,(声纳版本 - 7.7)
sonar.host.url=http://localhost:9000
sonar.login=admin
sonar.password=admin
sonar.projectKey=my-app
sonar.projectName=my-app
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.sources=src
sonar.exclusions=**/node_modules/**
sonar.tests=src
sonar.test.inclusions=**/*.spec.ts
sonar.typescript.lcov.reportPaths=coverage/my-app/lcov.info
sonar.scm.disabled=true
sonar.path.temp=C:\Sonar\sonarqube-7.7\temp
Is there any way to bring number of unit tests under coverage heading?有什么方法可以将单元测试的数量置于覆盖标题下?
Thanks in advance!提前致谢!
After many trial and error, finally got the no.of unit tests in sonar report.经过多次尝试和错误,终于得到了声纳报告中单元测试的数量。
Added sonar-scanner using the below command,使用以下命令添加声纳扫描仪,
npm install sonar-scanner --save-dev
Then in package.json file add the following lines in scripts,然后在 package.json 文件中,在脚本中添加以下行,
"scripts": {
"sonar": "sonar-scanner",
"sonar-scanner": "node_modules/sonar-scanner/bin/sonar-scanner.bat"
}
In sonar-project.properties file, add the below line在 sonar-project.properties 文件中,添加以下行
sonar.testExecutionReportPaths=test-report.xml
Finally run sonar using StartSonar.bat
and run最后使用StartSonar.bat
运行声纳并运行
npm run sonar
And when we run https:localhost:9000/projects, we can find no.of unit tests under coverage part.当我们运行 https:localhost:9000/projects 时,我们可以在 coverage 部分找到 no.of unit tests。
Reference links : https://medium.com/@learning.bikash/angular-code-coverage-with-sonarqube-d2283442080b参考链接: https://medium.com/@learning.bikash/angular-code-coverage-with-sonarqube-d2283442080b
https://medium.com/beingcoders/setup-sonarqube-with-angular-project-in-6-minutes-57a87b3ca8c4 https://medium.com/beingcoders/setup-sonarqube-with-angular-project-in-6-minutes-57a87b3ca8c4
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.