Sonar Coverage showing 0% and not reflecting in Dashboard

Must-share information (formatted with Markdown):

  • which versions are you using (Version : 4.17.0)
  • what are you trying to achieve (Code Coverage)
  • what have you tried so far to achieve this (Code coverage showing 0.0% in Dashboard and not reflecting).

I am running all these in Azure DevOps build pipeline and I am using below task in pipeline

task: SonarQubePrepare@4
displayName: “Prepare Sonar Analysis for Frontend”
inputs:
SonarQube: ‘Sonar’
scannerMode: ‘CLI’
configMode: ‘manual’
cliProjectKey: ‘TEST:TestFrontend’
cliProjectName: ‘Test Frontend’
cliProjectVersion: ‘branch’
cliSources: ‘test/src’
extraProperties: |
sonar.javascript.lcov.reportPaths=test/coverage/lcov.info

task: SonarQubeAnalyze@4
displayName: “Frontend Sonar Analysis”

while running above task in ADO I am getting below logs.

SonarQube - 4.17.0
INFO: Test Coverage Sensor is started
INFO: 17/17 source files have been analyzed
INFO: Analysing [/home/vsts/work/1/s/test/coverage/lcov.info]
WARN: Could not resolve 2 file paths in [/home/vsts/work/1/s/test/coverage/lcov.info], first unresolved path: vue.config.js

We could see that vue.config.js file there in root folder (i.e) under test/vue.config.js

After that still it showing 0.0% coverage in sonar dashboard. Please help and how coverage is not reflecting in Sonar?

Thanks
Mohamed Nazar

Hi @smmnazar,

Welcome to SonarSource community!

What is your base directory? Is it /home/vsts/work/1/s? You can check from the Sonar analysis logs on the line that says Base dir:

Joe