Typescript test coverage not displaying on sonarqube UI

Hi
I am not able to get my test coverage on sonarqube inspite of following the rules to write the script.
can someone please help me in this and tell me where am I going wrong

I could see the vulnerabilities and hotspot but not the test coverage
its showing as 0

Hi,

Welcome to the community!

I don’t see in that screenshot (BTW, we really don’t like screenshots. Copy/pasted text is much preferred! :smiley:) where you’re generating a coverage report or passing a report into analysis.

SonarCloud doesn’t figure out what is and is not tested. It just shows you what your coverage reports say.

 
HTH,
Ann

Hi Ann,
Thank you for the quick response.
I am using a configuration like this

      - name: Unit Tests
          run: yarn test

      - name: Prepare SonarQube Scanner
         run: |
           wget -O sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-linux.zip
           unzip sonar-scanner.zip
           mv sonar-scanner-5.0.1.3006-linux sonar-scanner

      - name: Analyze with SonarQube
          env:
            SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
          uses: sonarsource/sonarcloud-github-action@master
          with:
            args: >
              -Dsonar.organization=***
              -Dsonar.host.url=***
              -Dsonar.projectKey=***
              -Dsonar.login=***
              -Dsonar.sources=.
              -Dsonar.javascript.lcov.reportPaths=coverage/lcov.info

When I use a lcov.info viewer it shows the coverage but on sonarqube UI it shows 0%

Hi,

Thanks for the configuration. Can you share your analysis logs?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Ann