Code coverage not appearing in SonarCloud

My Azure Pipeline looks like :

task: SonarCloudPrepare@1
    inputs:
      SonarCloud: "SonarCloudServiceConnection"
      organization: "SOME-APPS"
      scannerMode: "CLI"
      configMode: "manual"
      cliProjectKey: "SOME-APPS-configurationapp"
      cliProjectName: "SOME-APPS-configurationapp"
      cliSources: "./"
      extraProperties: |
        sonar.exclusions=**/node_modules/**,**/*.spec.ts,**/*test.ts,**/*.js,**/*.scss,**/*.html
        sonar.tests=$(System.DefaultWorkingDirectory)/src/app
        sonar.sources=$(System.DefaultWorkingDirectory)/src/app
        sonar.test.inclusions=$(System.DefaultWorkingDirectory)/src/**/*.spec.ts
        sonar.typescript.lcov.reportPaths=$(System.DefaultWorkingDirectory)/coverage/configuration-application/lcov.info
        sonar.coverage.exclusions=**/node_modules/**,src/main.ts,src/polyfills.ts,**/*environment*.ts,**/*module.ts
        sonar.cobertura.reportPaths=coverage/configuration-application/cobertura-coverage.xml
        sonar.testExecutionReportPaths=coverage/configuration-application/cobertura-coverage.xml

And later in yml I have this also :

- task: PublishCodeCoverageResults@1
    displayName: "Publish code coverage Angular results"
    condition: succeededOrFailed()
    inputs:
      codeCoverageTool: 'Cobertura'
      summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage/configuration-application/cobertura-coverage.xml'
      reportDirectory: '$(System.DefaultWorkingDirectory)/coverage'
      failIfCoverageEmpty: false

I am not sure what is wrong but I can see this


But not in SonarCloud :

1 Like

Hello @Dibyanshu_Banerjee and welcome to our Community!

Maybe you have different paths between here:

And here:

Could you check this?

Yes the path was also wrong and also, the report path setting should be javascript, not typescript

changed to :

1 Like

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