Coverage disappeared

I am having an issue with the coverage report. It used to work without issues, but then it recently started to show a 0 coverage on my TS projects.

What’s notable is that even though I’ve disable the Automatic Analysis of my code, I am still getting the SonarCloud report comment before the GitHub action have executed the Sonar step, so I am guessing there is a problem with the setting. I can’t find it in my sonar project at the moment as described in the documentation. When I go to Analysis Method, all I see is this:

This project is part of a monorepo and the backend project (C#) works as expected, only the TS one got broken

  • versions used: SonarCloud + GitHub Actions


Hi @dstoyanoff, sorry to get back to you late!

Please check the end of the output of the scanner, triggered by GitHub Action. When Automatic Analysis is enabled, then the run by GitHub Action would fail, with a message like this:

INFO: ------------------------------------------------------------------------
INFO: ------------------------------------------------------------------------
INFO: Total time: 2.368s
INFO: Final Memory: 6M/34M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
ERROR: You are running manual analysis while Automatic Analysis is enabled. Please consider disabling one or the other.
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

If the analysis has succeeded, then it must have been really the CI job producing the report you see on SonarCloud, and not the Automatic Analysis as you suspect. You can also check the Administration / Background Tasks page of the project, and look at the Submitter column of the executions. For Automatic Analysis, the Submitter would appear as “Anonymous”, for your CI job it would be your login (for example foo@github).

Please confirm the above, and then we can continue to investigate how the coverage results disappeared. It will be useful to see the full scanner output. If you are not able to share it (because the project is private), let me know and I can start a private thread.

Hello @janos,
I can confirm that the background task runs with my name and the CI scan doesn’t fail, it just lacks coverage results in Sonar.

Thanks for confirming!

How do you generate the coverage reports?

How do you tell the scanner where to find the coverage reports?

In the output of the scanner, do you see warnings related to coverage reports?

We generate the reports using the jest coverage flag (lcov format). Then this is forwarded to Sonar using -Dsonar.typescript.lcov.reportPaths=coverage/ inside the GH action args prop, which used to work fine before.

The only error that’s related to the coverage that I see is 'JavaScript/TypeScript Coverage' skipped because one of the required properties is missing. I am not sure however which exactly property is that. Here is the full configuration of the GitHub action:

      - name: Analyze
        uses: SonarSource/sonarcloud-github-action@master
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
          projectBaseDir: frontend
          args: >

Let me know if there is any more information that I can provide

Looking at our documentation about test coverage, it seems the correct parameter name should be sonar.javascript.lcov.reportPaths. It seems the property name you used was considered deprecated, and recently dropped, on August 16th. It seems very likely that this caused your coverage reports to disappear. Please give this a try, and let us know how it goes!

Seems that solved the issue, thanks.
Strangely, I’ve migrated to GitHub 2mo ago and I didn’t see a deprecation notice. It’s a good idea to consider better communication for such breaking changes.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.