Code Coverage Dropped to 0% Despite Correct LCOV Report in CircleCI

Description:

Hi SonarCloud team,

I have been using SonarCloud for code coverage analysis with CircleCI for the past 1.5 years. Everything was working properly until recently, when I noticed that my code coverage dropped to 0% in SonarCloud, even though the LCOV report is being generated correctly and uploaded as expected.

Here are the details of the issue and the steps I’ve taken to investigate it:


Issue:

  • SonarCloud shows 0% code coverage despite the coverage report being generated correctly by Jest and uploaded via CircleCI.
  • I verified that the LCOV report is correctly generated in the coverage/lcov.info file and that this file is being uploaded to SonarCloud.
  • No changes were made to the SonarCloud configuration, Jest configuration, or CircleCI pipeline.
  • The lcov.info file contains correct coverage data, but SonarCloud does not reflect this coverage.

Steps Taken:

  1. CircleCI Pipeline Configuration:
  • The CircleCI pipeline runs tests with coverage using Jest and stores the lcov.info file in the coverage/ directory.
  • The coverage report is uploaded to SonarCloud using the sonarcloud/scan CircleCI orb.
  • The relevant part of the CircleCI config is as follows:
steps:
  - run:
      name: Testing application and Collect Coverage
      command: |
        npm ci
        npm run test:coverage
  - sonarcloud/scan
  - store_artifacts:
      path: coverage
  1. SonarCloud Configuration:
  • In the SonarCloud project settings, I have the following configuration in sonar-project.properties:

properties

sonar.projectKey=my-org_my-project
sonar.organization=my-org
sonar.sources=src
sonar.tests=src
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.test.inclusions=**/*.spec.ts
  1. What I Verified:
  • The LCOV report (lcov.info) is correctly generated and contains valid coverage data.
  • The SonarCloud Orb is correctly configured to upload the coverage report.
  • The SonarCloud analysis logs show no errors or warnings during the upload, but the coverage still shows as 0%.
  1. What I Have Checked:
  • CircleCI logs confirm that lcov.info is being generated.
  • The SonarCloud analysis logs do not show any issues.
  • SonarCloud project settings and SonarCloud Orb configuration are correct.

Request for Help:

  • Is there any recent issue or change on SonarCloud that might cause this behavior?
  • Could there be an issue with the LCOV report ingestion process in SonarCloud?
  • Could you provide any insights into what might be going wrong or what additional configuration might be needed?

I’m happy to provide additional information, including build logs or sample files, if necessary.

Thank you in advance for your assistance!

Hi,

Welcome to the community!

You mention the coverage report being “uploaded”. This implies to me that the report is not being generated in the same workspace in which analysis is run…?

The paths in the coverage report need to match the paths analysis is seeing.

Can you provide your analysis log?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Thx,
Ann