No coverage information will be saved because all LCOV files cannot be found in my javascript project using Github actions

I am using [sonar github action][1] for my code coverage, but it is coming as zero in my Github actions.

This is my workflow:

  sonarcloud:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          # Disabling shallow clone is recommended for improving relevancy of reporting.
          fetch-depth: 0
      - name: SonarCloud Scan
        uses: sonarsource/sonarcloud-github-action@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

and my sonar-project.properties:

sonar.projectKey={key}
sonar.projectName={name}
sonar.organization={org}

sonar.sources=src/
sonar.tests=test/
# sonar.test.exclusions= < No exclusions currently >
sonar.javascript.lcov.reportPaths=coverage/lcov.info

Please help me solve the issue. [1]: https://github.com/SonarSource/sonarcloud-github-action

Upvotes: 1

Views: 2855

Answers (1)

goarun112
goarun112

Reputation: 26

check the exact location of lcov.info file

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

for my scenario locv.info file located in coverage/<project_name>/locv.info

sonar.javascript.lcov.reportPaths=coverage/<project_name>/lcov.info

Upvotes: 1

Related Questions