Currently, it’s unclear whether the SonarQube scanner automatically merges multiple reports, or if users are expected to merge them manually and configure the analysis to use the consolidated report.
Some properties support the following wildcards in paths. The remarks for properties that support wildcards will mention this fact.
The remarks for sonar.javascript.lcov.reportPaths do not mention supporting wildcards. Sorry, but you’ll have to type out the comma-delimited list the parameter is expecting.
Thank you so much for your response! I really appreciate your help.
I wanted to clarify a couple of points and suggest a possible update to the documentation:
It appears that wildcards are actually supported, even though this isn’t currently mentioned in the documentation. For example, when using sonar.javascript.lcov.reportPaths=coverage-artifacts/**/lcov.info, the analyzer detects the files as showed by the logs below:
INFO Analysing [/home/runner/work/.../coverage-artifacts/lcov-info-shard-1/lcov.info, /home/runner/work/.../coverage-artifacts/lcov-info-shard-2/lcov.info, /home/runner/work/.../coverage-artifacts/lcov-info-shard-3/lcov.info]
My main concern is about how these separate coverage files are processed by the analyzer. The documentation doesn’t seem to specify this. In my experience, Sonar was unable to reconcile the coverage correctly when analyzing multiple files. However, after explicitly merging the files, the coverage was reported correctly:
INFO Analysing [/home/runner/work/.../coverage-artifacts/merged-lcov.info]
Would it be possible to check with the development team and consider updating the documentation? It would be really helpful to add a section about handling coverage for Jest shards and clarify how multiple coverage files are processed.
the fix was merged and SonarJS was released today. Should be deployed in a couple of days. Please let me know if the lcov import is working as expected with SonarJS 12.1