Warning message Cannot save coverage result for file and sonar dashboard shows 0% coverage

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

  • Community Edition

  • Version 9.4 (build 54424)

  • LGPL v3

  • what are you trying to achieve
    We are using Cobertura to generate the coverage and we have the coverage.xml file for the javascript files

  • what have you tried so far to achieve this

It says resource not found, but path showing has the file

Below is the command I have executed :
sonar-scanner -Dsonar.projectKey=TestProject -Dsonar.sources=. -Dsonar.host.url=http://localhost:9000 -Dsonar.login=c38e98a5d12bdd8c7d2be49e55f4c2bb6a8e2d13


sonar.projectName=Test Project


INFO: Analyzing Cobertura report: target/jscoverage/coverage.xml
WARN: Cannot save coverage result for file: /assert.js, because resource not found.

Could you please help here


Welcome to the community!

First, I just want to warn you about posting sonar.login values publicly. Normally I’d remind you to invalidate that token, but this time you’re probably good since no one knows where your localhost is. :smiley:

Second, it’s worth noting that Cobertura doesn’t seem to be supported for JavaScript…

Are you trying to use that sonar.flex.cobertura parameter as a way to try to bypass the limitation? If so, it won’t have the effect you think it will.

And finally, the warning in your logs indicates that analysis is looking for assert.js in machine root. If it exists in project root, then the problem is that leading /. The paths in your coverage report should either be relative to project root, or full paths that are valid on the machine.