Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SonarQube Lcov.info not found

Tags:

sonarqube

I'm having an issue with a SonarQube instance. We're printing out lcov information from istanbul, but sonarqube can't find the lcov information to generate code coverage. The project.properties file is here with the lcov information now removed :

sonar.projectKey=*****
sonar.projectName=*****
sonar.projectVersion=1.0
sonar.host.url=***********
sonar.sources=.
sonar.projectBaseDir=./app
sonar.exclusions=**/bower_components/**/*.*,**/vendor/**/*.*
sonar.language=js
sonar.sourceEncoding=UTF-8
sonar.verbose=true
sonar.log.level=DEBUG

but the logs from sonarqube say it's still looking for it :

11:19:12.551 INFO: 177/225 files analyzed, current file: /app/app/target/schema/list/target-schema-list-controller_test.js
11:19:15.103 INFO: Unit Test Coverage Sensor is started
11:19:15.103 INFO: 225/225 source files have been analyzed
11:19:15.104 WARN: No coverage information will be saved because LCOV file cannot be found.
11:19:15.104 WARN: Provided LCOV file path: coverage-app/html/lcov.info. Seek file with path: /app/app/coverage-app/html/lcov.info
11:19:15.105 WARN: No coverage information will be saved because all LCOV files cannot be found.
11:19:15.105 INFO: Integration Test Coverage Sensor is started
11:19:15.105 WARN: No coverage information will be saved because LCOV file cannot be found.
11:19:15.106 WARN: Provided LCOV file path: coverage-server/lcov.info. Seek file with path: /app/app/coverage-server/lcov.info
11:19:15.106 WARN: No coverage information will be saved because all LCOV files cannot be found.
11:19:15.106 INFO: Overall Coverage Sensor is started
11:19:15.106 WARN: No coverage information will be saved because LCOV file cannot be found.
11:19:15.106 WARN: Provided LCOV file path: coverage-app/html/lcov.info. Seek file with path: /app/app/coverage-app/html/lcov.info
11:19:15.106 WARN: No coverage information will be saved because LCOV file cannot be found.
11:19:15.107 WARN: Provided LCOV file path: coverage-server/lcov.info. Seek file with path: /app/app/coverage-server/lcov.info
11:19:15.107 WARN: No coverage information will be saved because all LCOV files cannot be found.

If it's not getting the location from the project properties where I'm running the sonarqube program from, then where else can it be reading the config from ?

like image 999
Tim Heap Avatar asked Jan 30 '23 15:01

Tim Heap


2 Answers

You should add this setting in your sonar-project.properties file:

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

Also, in some CI tools (in my case is Gitlab CI) you might have to specify that the lcov.info file is an "artifact" so the sonar scanner job doesn't delete it

like image 174
Uri Stolar Avatar answered Mar 06 '23 05:03

Uri Stolar


Remember the project folder inside the coverage folder

sonar.javascript.lcov.reportPaths=coverage/<project-name>/lcov.info
like image 21
mpumi Avatar answered Mar 06 '23 03:03

mpumi