SonarCloud Code Coverage & Unit Test 0% for Cobertura, Junit & Lcov

Hey everyone.

I’ll need your help. We are trying to analyze an angular project with SonarCloud via Azure DevOps Pipeline. We are using 3 tasks to do this (setting the unrequired info as $$$).

  1.  - task: SonarCloudPrepare@1
     displayName: SonarCloudPrepare
     inputs:
       SonarCloud: $$$'
       organization: '$$$'
       scannerMode: 'CLI'
       configMode: 'manual'
       cliProjectKey: '$$$'
       cliProjectName: '$$$'
       cliSources: '.'
       extraProperties: |
         sonar.verbose=true
         sonar.cobertura.reportPath=$(System.DefaultWorkingDirectory)/coverage/$$$/cobertura-coverage.xml
         sonar.typescript.lcov.reportPaths=coverage/$$$/lcov.info
    
  2.   - task: SonarCloudAnalyze@1
     displayName: SonarCloudAnalyze
    
  3.  - task: SonarCloudPublish@1
     displayName: SonarCloudPublish
     inputs:
       pollingTimeoutSec: '600'
    

We are generating Cobertura Coverage and it works OK in Azure DevOps, we;re using Karma, Junit and lcov (via karma) however for some reason the files are not being imported to SonarCloud so we get 0% coverage.

Through the output / info we’re getting the following: 17:10:47.494 DEBUG: File ‘D:\a\1\s\coverage$$$\cobertura-coverage.xml’ is excluded by the scm ignore settings.

Could you please assist us and guide us on how to include the Code Coverage & Test numbers?
We really do need help with this one.

Kind regards!

Hi Dragan,

Instead of sonar.cobertura.reportPath,
the keyword is plural, so change to sonar.cobertura.reportPaths


Regards,
Monty

I believe that was a copy-past typo :slight_smile: sadly, it does not solve the issue…
Even if we try to use lcov.info only the Debug info we’re getting is the following: DEBUG: File ‘D:\a\1\s\coverage$$$\lcov.info’ is excluded by the scm ignore settings

We’re getting the same issue for both, cobertura and lcov.

What are your git SCM ignore settings for this project — would you attach .gitignore files?