Cannot get coverage data from LCOV files

Must-share information (formatted with Markdown):

  • Sonarqube Community Edition v7.6; SonarScanner 4.6.2.2472
  • Scan a monorepo project with multiple sub-projects and include their generated coverage

I have a monorepo project successfully being scanned for static analysis in SQ. Please note, all sub-projects live in the projects folder, but not all have unit tests.
I also have unit tests being run before scan, and have successfully produced lcov.info files. Note, these files are 1 per sub-project.

My sonar-project.properties file is as follows:

# Base setup
sonar.projectKey=(key)
sonar.projectName=(name)
sonar.sources=projects
sonar.javascript.lcov.reportPaths=projects/admin2/coverage/lcov.info
sonar.coverage.exclusions=**/karma.conf.js
sonar.log.level=TRACE

I can see in the debug trace for the scanner that file appears to be found (no error), but nothing further seems to happen:

....
11:29:36.107 INFO: Sensor SonarJS Coverage [javascript]
11:29:36.107 INFO: 30/30 source files have been analyzed
11:29:36.108 INFO: Analysing [/builds/zapinfo/frontend/projects/admin2/coverage/lcov.info]
11:29:36.113 INFO: Sensor SonarJS Coverage [javascript] (done) | time=6ms
11:29:36.113 INFO: Sensor Zero Coverage Sensor
11:29:36.290 INFO: Sensor Zero Coverage Sensor (done) | time=176ms
11:29:36.291 INFO: ------------- Run sensors on project
....

An example lcov.info file looks like this:

TN:
SF:projects/admin2/src/polyfills.ts
FNF:0
FNH:0
DA:62,1
DA:63,1
DA:64,1
DA:65,1
DA:71,1
LF:5
LH:5
BRF:0
BRH:0
end_of_record
TN:
SF:projects/admin2/src/test-common.ts
FNF:0
FNH:0
DA:9,1
DA:11,1
DA:20,1
LF:3
LH:3
BRF:0
BRH:0
end_of_record
...(more data)

I can confirm via the index.html generated by the tests that there is in fact coverage happening.

I can’t tell why the coverage is showing as 0%. There are no errors output.

Hi,

Welcome to the community!

Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

7.6 → 7.9.6 → 8.9.8 → 9.4 (last step optional)

You may find the Upgrade Guide and the LTS-to-LTS Upgrade Notes helpful. If you have questions about upgrading, feel free to open a new thread for that here.

If your problem persists after upgrade, please come back to us.

 
Ann

Regrettably, this is managed by my company. I think we are in fact working on getting to 8.9, but timeframe is uncertain. Is there no recourse for debugging this until that is done?

Hi,

Your version is ~3.5y and >2LTSs old. Sorry, but the archived docs from back then don’t even include coverage (they point out to an external site that’s no longer there).

 
:woman_shrugging:
Ann