Local SonarScanner not importing lcov.info for react project

I have a react typescript project, and I am trying to do use sonar scanner to get code coverage locally. Currently code coverage is showing 0%. I’ve generated a lcov.info file by using npm test --coverage . Now, I am trying to get sonar-scanner to read the lcov.info file, however, I think sonar-scanner is not reading the lcov.info file.

in sonar-project.properties:

sonar.sources=src
sonar.exclusions=**/__tests__/**/*, **/*.d.ts, src/serviceWorker.ts
sonar.tests=src
sonar.test.inclusions=**/__tests__/*

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

I have tried using sonar.typescript.lcov.reportPaths=**/lcov.info as well, but it does not solve the problem.

In the sonarscanner logs, I found this.

INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=5ms

I think it might be strange that this is in the logs, given that this is not a Java project. What can I do to let sonar scanner read my lcov.info?

Hi,

Welcome to the community!

I understand why you’re confused by the JaCoCo logs. The scanner is simply telling you that as a standard practice, it looked for a JaCoCo report & didn’t find one.

But do you have an log lines related to lcov?

 
Ann