How To Upload Karma Test Report To Sonar?
Solution 1:
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.tsFN:11,(anonymous_3)FN:17,ChildComponentFN:22,(anonymous_5)FNF:3FNH:3FNDA:1,(anonymous_3)FNDA:3,ChildComponentFNDA:1,(anonymous_5)DA:1,1DA:3,1DA:11,1
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
Works fine for Angular2 Typescript Sonar plugin as well. https://github.com/Pablissimo/SonarTsPlugin
Solution 2:
If you are using typescript change sonar.typescript.lcov.reportPaths
Solution 3:
You will have to add a property called <sonar.javascript.lcov.reportPath>
for sonar to identify lcov file. This property should point to the location of the lcov.info
file.
And ensure javascript plugin is installed in sonar server.
Solution 4:
The path of your LCOV report is set to /lcov.info
which looks like an absolute path: is your report really located at the root of your file system?
If your LCOV report is not at the root of the file system but at the root of your project, then the path of the LCOV report should be lcov.info
, not /lcov.info
.
Post a Comment for "How To Upload Karma Test Report To Sonar?"