Sonarcloud for typescript project showing 0 coverage

hey guys, i have a step in my bitbucket pipeline which runs SonarCloud analysis scan for my typescript project,
by the end of the pipeline run it shows SonarCloud analysis was successful, but sonarcloud dashbord always showing 0 coverage

the pipeline step-

  • step:
    name: Unit tests
    caches:
    - node-modules
    - yarn
    - sonar
    script:
    - cd next_app
    - yarn install
    - yarn jest --coverage
    - pipe: sonarsource/sonarcloud-scan:1.2.1
    variables:
    SONAR_TOKEN: ${SONAR_TOKEN}

my jest configuration on package.json-
“jest”: {
“testPathIgnorePatterns”: [
“/.next/”,
“/node_modules/”
],
“collectCoverage”: true,
“coverageDirectory”: “./coverage”,
“testResultsProcessor”: “jest-sonar-reporter”
},

sonar-project.properties file-
sonar.sources=.

sonar.tests=src

sonar.test.inclusions=’/testing/,/*.spec.ts,/*.spec.tsx’

sonar.typescript.lcov.reportPaths=./coverage/lcov.info

sonar.testExecutionReportPaths=./test-report.xml

any help will be much appreciated!

Hi @Gili_Shem , as of August 16th the property for typescript coverage got deprecated in favor of sonar.javascript.lcov.reportPaths and you have to replace it in your pipeline step. You can read more about coverage in our documentation.

Please, let us know if that works or if there’s anything else we can help you with!

Best regards,
Antonio

Hi Antonio Garcia

I faced similar issue: Sonarcloud- shows 0 coverage for Typescript (Using AzureDevOps Pipeline)

I am using ADO pipeline for running the tasks. Appreciate your assistance on this.