Code Coverage is not shown up on the sonarqube Dashboard

Hi,

One of the projects in my organization is not showing code coverage and we have been working to resolve this for a long time now but not able to find a solution . Please help us in resolving it . I am attaching the required information and logs below.

Sonarqube Version :- 8.9.1 Enterprise Edition

Sonar Config :-1:

sonar.exclusions=**/node_modules/**
sonar.projectBaseDir=$(Build.SourcesDirectory)\{Organization-Name}.VR.UI
sonar.sourceEncoding=UTF-8
sonar.tests=src
sonar.test.inclusions=**/*.spec.ts,**/*test.ts
sonar.coverage.exclusions=**/*.js,src/*main*.ts,**/*polyfills*.ts,**/*environment*.ts,**/*module.ts
sonar.typescript.lcov.reportPaths={Organization-Name}.VR.UI/coverage/lcov.info

Also Attaching logs with this request.
Do let me know if any other information is required from our end.

Regards,
Rishikesh Pandey

Logs.txt (9.4 KB)

Hi,

Welcome to the community!

I notice a number of things about your analysis parameters, but let’s start with what’s most pertinent: According to the docs, the parameter name is sonar.javascript.lcov.reportPaths. javascript, not typescript. Yes, I know it’s confusing.

That will probably solve your problem, but I want to point out a few other things:

The docs say you can use a comma-delimited list of paths for sonar.tests, so you should be able to simplify this to:

sonar.tests=src/**/*.spec.ts,src/**/*test.ts

This parameter is only needed in unusual circumstances. You should drop this & start analysis from the project root directory.

You don’t seem to be specifying sonar.sources. It defaults to . (the current directory), but it would be better to be specific about what you want to analyze.

 
HTH,
Ann

Hi Ann,

Thank you for your reply, I have made the suggested changes but still no success.
I am attaching the latest logs and the current sonar configuration below. Do let us know your inputs.

Sonar Config

sonar.exclusions=**/node_modules/**
sonar.sourceEncoding=UTF-8
sonar.sources=Eurofins.VR.UI/src
sonar.test.inclusions=**/*.spec.ts,**/*test.ts
sonar.coverage.exclusions=**/*.js,src/*main*.ts,**/*polyfills*.ts,**/*environment*.ts,**/*module.ts
sonar.javascript.lcov.reportPaths={Organization-Name}.VR.UI/coverage/lcov.info

Logs.txt (9.8 KB)

Hi,

I’m seeing this:
2022-03-22T08:18:42.5410600Z WARN: Could not resolve 193 file paths in [D:\a\1\s\{Organization-Name}.VR.UI\coverage\lcov.info], first unresolved path: src\test.ts

You need to make sure the paths in your coverage report match up to the paths the scanner is seeing. Your sonar.sources configuration starts with Eurofins.VR.UI but the path in the coverage report does not.

 
HTH,
Ann

Im getting the same issue. Sonarqube isnt showing code coverage? Please help me to resolve this.
Sonar Config
sonar.projectKey=hk-backend-evolved
sonar.projectName=hk-backend-evolved
sonar.sources=/var/lib/jenkins/workspace/Cicd
sonar.login=<token>
sonar.javascript.lcov.reportPaths=Icov.info

Logs.txt (8.4 KB)

Hi @Anji,

Welcome to the community!

This thread is a year old. Per the FAQ, please create a new thread.

 
Ann