No code coverage when using CLI scan method for NPM

  • ALM used: Azure DevOps
  • CI system used: Azure DevOps
  • Languages of the repository: NPM
        - task: SonarCloudPrepare@1
          displayName: SonarCloud Prepare
          inputs:
            SonarCloud: 'Test'
            organization: 'test'
            scannerMode: 'CLI'
            configMode: 'manual'
            cliProjectKey: '${{ parameters.SonarCloudProjectKey }}'
            cliProjectName: '${{ parameters.SonarCloudProjectName }}'
            cliSources: '${{ parameters.SonarCloudSources }}'
          env:
            SONAR_SCANNER_OPTS: -Xmx8192m
          continueOnError: true

      - task: NodeTool@0
        displayName: "Install Node.js"
        inputs:
          versionSource: "spec"
          versionSpec: "18.x"

      - task: Npm@1
        displayName: "Npm install  - Angular CLI"
        inputs:
          command: "custom"
          customCommand: "install -g @angular/cli@14.0.7"
          verbose: false

      - task: Npm@1
        displayName: "Npm Install "
        inputs:
          command: "install"
          workingDir: "${{ProjectPath}}"

      - task: Npm@1
        displayName: "Npm build"
        inputs:
          command: "custom"
          workingDir: "${{ProjectPath }}/"
          customCommand: "run build${{NpmCustomBuildCommand }}"

     - task: SonarCloudAnalyze@1
       displayName: SonarCloud Analyze
       continueOnError: true

    - task: SonarCloudPublish@1
      displayName: SonarCloud Publish
      inputs:
         pollingTimeoutSec: '300'
         continueOnError: true

  - publish: "$(Build.ArtifactStagingDirectory)"


Hey there.

I suggest starting at the documentation here: JavaScript/TypeScript Test Coverage | SonarCloud Docs