如何将业力测试报告上传到声纳? [英] How to upload karma test report to sonar?

查看:124
本文介绍了如何将业力测试报告上传到声纳?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我配置了因果报应,因此覆盖率报告非常好.
它以lcov格式显示给我. 引用此 http://docs.sonarqube.org/display/PLUG/JavaScript +覆盖率+结果+导入
lcov报告可以上传到声纳.

I have karma configured which gives me coverage report perfectly fine.
It gives me in lcov format. Referring to this http://docs.sonarqube.org/display/PLUG/JavaScript+Coverage+Results+Import
lcov report can be uploaded to sonar.

我已经在声纳中安装了插件. 我的项目是通过ant脚本构建的,所以我已经添加了

I have installed the plugin in sonar. My project builds through ant scripts so i have added

<property name="sonar.javascript.lcov.reportPath" value="/lcov.info"/>

我在一些博客上读到,lcov需要纠正,以便声纳可以理解它.我已经完成了.
这样就可以生成lcov并采用正确的格式.

I read on some blogs that lcov needs to be corrected so that sonar can understand it. I am done with it.
So lcov gets generated and is in the correct format.

由于某种原因,声纳无法找到我的lcov报告,因此无法解析该报告.我检查了路径是否正确.
我错过了什么吗? 任何帮助将不胜感激.

For some reason the sonar is unable to find my lcov report and does not parse the report. I checked my path it is correct.
Am I missing on something ? Any help would be appreciated.

推荐答案

lcov.info可能具有错误的文件路径.其他工具(如工作服)可以正常工作,而声纳则需要相对路径.这是我的lcov.info的外观. /source /app/simplebind/child.component.ts不正确,因此提示 src /app/simplebind/child.component.ts

lcov.info may have incorrect file paths. Other tools like coveralls work fine and sonar expects the relative path. Here is how my lcov.info looked. /source/app/simplebind/child.component.ts was incorrect and sonarqube expected src/app/simplebind/child.component.ts

TN:
SF:/source/app/simplebind/child.component.ts
FN:11,(anonymous_3)
FN:17,ChildComponent
FN:22,(anonymous_5)
FNF:3
FNH:3
FNDA:1,(anonymous_3)
FNDA:3,ChildComponent
FNDA:1,(anonymous_5)
DA:1,1
DA:3,1
DA:11,1

使用以下命令替换lcov.info中的文件路径.您可以在jenkins shell中构建gulp之后执行它.

Use following command to replace the file path in lcov.info. You can execute it after gulp build from your jenkins shell.

sed -i -- 's/\/source/src/g' report/remap/lcov.info

同样适用于Angular2 Typescript Sonar插件. https://github.com/Pablissimo/SonarTsPlugin

Works fine for Angular2 Typescript Sonar plugin as well. https://github.com/Pablissimo/SonarTsPlugin

这篇关于如何将业力测试报告上传到声纳?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆