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 ?
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
Remember the project folder inside the coverage folder
sonar.javascript.lcov.reportPaths=coverage/<project-name>/lcov.info
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With