Unable to get coverage in PR level analysis for Typescript Project

Not able to get coverage in PR level analysis for Typescript Project

My code -

  • name: Run SonarQube analysis
    uses: SonarSource/sonarqube-scan-action@v4
    env:
    SONAR_TOKEN: ${{ env.SONAR_TOKEN }}
    SONAR_HOST_URL: ${{ env.SONAR_HOST_URL }}
    SONAR_PULLREQUEST_PROVIDER: GitHub
    SONAR_PULLREQUEST_KEY: ${{ github.event.pull_request.number }}
    SONAR_PULLREQUEST_BRANCH: ${{ github.head_ref }}
    SONAR_PULLREQUEST_BASE: ${{ github.base_ref }}
    with:
    args: >
    -Dsonar.projectKey=react-native-frontend-master
    -Dsonar.sources=src
    -Dsonar.inclusions=${{ steps.split-paths.outputs.src_files }}
    -Dsonar.tests=src
    -Dsonar.test.inclusions=“/tests//.spec.tsx,/tests//.spec.ts”
    -Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info
    -Dsonar.typescript.tsconfigPath=tsconfig.json
    -Dsonar.login=${{ env.SONAR_TOKEN }}
    -Dsonar.pullrequest.githubToken=${{ env.GITHUB_TOKEN }}
    -Dsonar.scm.provider=git
    -Dsonar.scm.disabled=false
    -Dsonar.pullrequest.provider=${{ env.SONAR_PULLREQUEST_PROVIDER }}
    -Dsonar.pullrequest.key=${{ env.SONAR_PULLREQUEST_KEY }}
    -Dsonar.pullrequest.branch=${{ env.SONAR_PULLREQUEST_BRANCH }}
    -Dsonar.pullrequest.base=${{ env.SONAR_PULLREQUEST_BASE }}
    -Dsonar.host.url=***********
    -Dsonar.verbose=true

Please anyone help, in main dashboard I am able to get the coverage

PR Log of sonar analysis -
10_Run SonarQube analysis.txt (6.8 MB)

It sure looks like your coverage file is being found.

2025-06-23T19:27:04.5824290Z 19:27:04.559 INFO  Sensor JavaScript/TypeScript Coverage [javascript]
2025-06-23T19:27:04.5824730Z 19:27:04.559 DEBUG Property sonar.javascript.lcov.reportPaths is used.
2025-06-23T19:27:04.5825110Z 19:27:04.559 DEBUG Using './coverage/lcov.info' to resolve LCOV files
2025-06-23T19:27:04.5825650Z 19:27:04.559 INFO  Analysing [/Users/ec2-user/actions-runner/_work/d11-react-native/d11-react-native/./coverage/lcov.info]
2025-06-23T19:27:04.5826210Z 19:27:04.565 INFO  Sensor JavaScript/TypeScript Coverage [javascript] (done) | time=6ms

I’d suggest adding a cat ./coverage/lcov.info to your pipeline to see if this file actually contains valid coverage data.

:warning: Your version is past EOL. You should update to either the latest version or the current LTA (long-term active version) at your earliest convenience. Your upgrade path is:

9.9.4 → 2025.1.2-> 2025.3.1 (last step optional)

You may find these resources helpful: