- CI system used: CircleCI
- Languages of the repository: typescript/javascript, that’s a GCP Cloud Function
The problem is that the Line Coverage % and coverage % overall differ between local/CircleCI test runs, and the ones that SonarCloud shows inside the “Coverage” section of the project. Here’s the screenshot from the SonarCloud:
And here is the coverage report log from the CircleCI, which is shown before the SonarCloud job run:
------------|---------|----------|---------|---------|---------------------------------------------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
------------|---------|----------|---------|---------|---------------------------------------------------------
All files | 74.82 | 60.46 | 55.55 | 75.17 |
helpers.ts | 50 | 27.27 | 50 | 48.71 | 58-76,86-91,103-115
index.ts | 84.11 | 65.33 | 66.66 | 84.9 | 121,149-150,164,168,172,177,185,190,195,223,229,275-280
------------|---------|----------|---------|---------|---------------------------------------------------------
Test Suites: 1 passed, 1 total
Tests: 7 passed, 7 total
Snapshots: 0 total
Time: 5.305 s, estimated 11 s
As you may see here is the difference between “% Lines” - “SonarCloud Line Coverage” from the log and the screenshot:
All Files: 75.17% - 75.8%
helper.ts: 48.71% - 47.5%
index.ts: 84.9% - 85.8%
The difference isn’t that big, because of the small codebase scale. But on a larger scale, it is much greater, sometimes getting over 5-10% at least, which is the difference between passing or not 80% minimum threshold.
Can someone tell me why that might be happening and if it is normal for SonarCloud to show slightly different results for the same report file?
