Coverage for imported libraries is getting included in lcov file

We have implemented microfrontend in our angular project that results in ‘Projects’ folder getting created parallel to ‘src’ folder.
src component uses libraries, components from ‘projects’ folder to implement some features.
we have saperate tests and respected lcov files for all modules in ‘projects’ folder plus ‘src’ folder that we are providing in ‘sonar.typescript.lcov.reportPaths’.
Problem is while running the scan for ‘src’ folder, inside lcov file we get entries for ‘projects’ libraries as well, which we need to avoid.
below are the version details for -
SonarQube : 7.9
sonar-scanner: 3.1.0
node: 14.15.0
karma-coverage: 2.0.3
Angular: 12
typescript 4.2.4 (added as dev dependency)

Below is the files -


sonar.typescript.lcov.reportPaths=projects/global/coverage/,projects/shared/coverage/, coverage/

Folder structure -

Coverage folder for src looks like below -

Any help would be appreciated.


First, 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.9 → 8.9.3 → 9.1 (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.

Beyond that, it seems that you’ve got a number of extraneous parameters in your file:

sonar.analysis.mode=publish - this is long since dropped
sonar.issuesReport.console.enable=true - similarly, long since remove**/target/classes - if your project is pure TypeScript, you certainly don’t need this**/target/*.jar - you don’t need this either for a TypeScript project

Regarding your actual question, you seem to be complaining that your LCOV report contains the wrong data. SonarQube only reflects the data that shows up in your reports. If the reports have the wrong data, then you’ll need to fix that before it gets to SonarQube.