Cannot get code coverage analysis result for a PR

Hello,

We have been getting coverage correctly for most of the PRs.

However, we have a PR that has all analysis results except coverage.
As far as I know, SonarCloud doesn’t enforce coverage conditions when there are fewer than 20 changed lines. The PR has 42 new lines: 33 lines are in a file and 9 are in another file.
Files paths are not in the exclusions.

Why don’t we get a coverage analysis for that PR?

Our system:

  • ALM used is GitHub
  • CI system used is Github
  • Languages of the repository are JS and vue
  • Background task ID: AYjT3RfcnqkMsi10FzM9

Hi,

When you look at the lines and files changed in the PR, are they lines of code or lines of tests and/or configuration?

 
Ann

Hello @ganncamp,

They are lines of code, not tests or config.

Hi,

Can you share a screenshot of the PR’s Code tab, and also your full analysis log?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Ann

Hello @ganncamp ,

Here is the screenshot of the code tab:

I’ve looked at the link you shared and then I found the part of the scanners log which is related to coverage:

INFO: Sensor CSS Rules [javascript] (done) | time=206ms
INFO: Sensor JavaScript/TypeScript Coverage [javascript]
INFO: Analysing [/github/workspace/./coverage/lcov.info]
WARN: Invalid character encountered in file /github/workspace/src/assets/Recognyte-Logo-on-white-digital.png at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using the property 'sonar.sourceEncoding'.
WARN: Could not resolve 32 file paths in [/github/workspace/./coverage/lcov.info]
WARN: First unresolved path: src/config/dotEnv.js (Run in DEBUG mode to get full list of unresolved paths)
INFO: Sensor JavaScript/TypeScript Coverage [javascript] (done) | time=69ms

We get the same issue in another PR. I’ve just checked its logs and I notice the same warning about UTF-8.

Hi,

I’d really prefer the full analysis log, redacted as necessary.

What you’re showing, though, is a problem with matching the file paths in the coverage report with the file paths analysis sees. So that’s where you need to start looking.

Also, I believe I see in the upper-right corner of your latest screenshot that there’s a warning on the analysis…?

 
Ann

Hi,

I´ve got some similar issue after the release for JavaScript/TypeScript JS_10.3.1
We setup a workaround and this problem with coverage code starts.

In our case, more details HERE