Sonar code coverage not showing up for Angular project with Karma

Hi,

I am not able to see Code coverage for Angular project with Karma in my Sonarqube.

I see a coverage folder being generated with below folders and files when I do the build. So assuming reports are getting generated.
drwxr-xr-x 3 nonprod nonprod 182 Jan 13 20:22 lcov-report
-rw-r–r-- 1 nonprod nonprod 9.1K Jan 13 20:22 lcov.info
-rw-r–r-- 1 nonprod nonprod 5.3K Jan 13 20:22 base.css
-rw-r–r-- 1 nonprod nonprod 540 Jan 13 20:22 favicon.png
-rw-r–r-- 1 nonprod nonprod 2.4K Jan 13 20:22 block-navigation.js
-rw-r–r-- 1 nonprod nonprod 5.2K Jan 13 20:22 sorter.js
-rw-r–r-- 1 nonprod nonprod 209 Jan 13 20:22 sort-arrow-sprite.png
-rw-r–r-- 1 nonprod nonprod 676 Jan 13 20:22 prettify.css
-rw-r–r-- 1 nonprod nonprod 18K Jan 13 20:22 prettify.js
-rw-r–r-- 1 nonprod nonprod 12K Jan 13 20:22 index.html
drwxr-xr-x 3 nonprod nonprod 55 Jan 13 20:22 src

However, issue seems like sonar is not able to read and display them.

I have provided the path of lcov.info in my sonar.project.properties file to send the report to Sonar.
sonar.javascript.lcov.reportPaths=coverage/lcov.info

However, Sonar is not displaying any coverage. Any insights will be appreciated. Thanks in advance!

Hi,

Welcome to the community!

Your title mentions Karma, but there’s no direct support for Karma reports; you need to translate them to the Generic format, as mentioned in the docs.

Then the body of your post talks about LCov. To look at that, we’ll need to look at your analysis logs. Can you copy/paste them with code formatting (``` on the line before and on the line after)?

 
Ann