Test reports SonarQubeCli Docker JavaScript

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • how is SonarQube deployed: zip, Docker, Helm
  • what are you trying to achieve
  • what have you tried so far to achieve this

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

I am invoking sonar-scannar-cli in a github action using docker with this command.

      docker run -i --user `id -u` --rm -e SONAR_TOKEN -e SONAR_HOST_URL \
      -v `pwd`:/app -w sonar-scanner-cli \
        -Dsonar.projectKey= \
        -Dsonar.sources="./" \
        -Dsonar.pullrequest.key="${{ github.event.number }}" \
        -Dsonar.pullrequest.branch="${{ github.head_ref }}" \
        -Dsonar.pullrequest.base="${{ github.base_ref }}" \
        -Dsonar.qualitygate.wait=false

Test run reports are generated in the previous step in lcov format.

in the run log i see this error:

ERROR: Failure when reading cache entry

java.io.IOException: The cache stream is too big (>2264) for file /app/.scannerwork/ucfg2/js/ite_AWS_CCD_Queries_html.ucfgs

Run report result: No Coverage information

How do I get test run results in sonar?

Appreciate any leads.

Thanks.

Hey there.

Are you trying to import test run results, or code coverage?

H Colin, Coverage. If possible test run results too.

Raghu

Take a look at the documentation on Javascript/Typescript Test Coverage – specifically make sure you’re passing your lcov report to sonar.javascript.lcov.reportPath.

For test execution results… I’d discourage you from trying to get them imported. You’d need to find a way to convert your reports to Generic test execution format, and even then, all you get is a count of the unit tests in your project. This feature is always a candidate for deprecation/removal.

I tried multiple options for -Dsonar.javascript.lcov.reportPaths= ; I get INFO: No LCOV files were found using ./mo-ccd/gcp/coverage/
168WARN: No coverage information will be saved because all LCOV files cannot be found.

Should I copy the test report files over for docker to process?

I copied the entire directory containing the lcov.info file to /tmp. Get the same message. INFO: No LCOV files were found using /tmp/coverage/lcov.info

615WARN: No coverage information will be saved because all LCOV files cannot be found.