Code coverage difference for angular app

SonarQube Version: 8.9.10 (Community Edition)

On Jenkins (Based on Linux)
NodeJS: v18.17.1
NPM : 9.5.1

On local System (Windows based)
NodeJS: v18.17.1
NPM: 7.5.6

dependency under package.json
Sonar-Scanner: ^3.1.0

Content of









coverageReporter in karma.conf.js

coverageReporter: {
dir: require(‘path’).join(__dirname, ‘coverage/’),
//subdir: ‘.’,
reporters: [
{ type: ‘html’, subdir: ‘report-html’ },
{ type: ‘lcov’, subdir: ‘report-lcov’ },

When I execute karma tests using npm run test which generates code coverage report shows around 48% of code coverage as seen below

However, when analysis hits the SonarQube the code coverage dips to 41.7% as seen in below screenshot

I compared file generated on local and on Jenkins. I found there are few differences in the content of these two files. But I am not sure how should I debug this to match the coverage report on local and Sonar.

Could some one please enlighten me on this ?


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:

8.9.10 → 9.9.3 → 10.3 (last step optional)

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

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