No coverage metric for React Native

I have React Native project, and SonarCloud shows 0% code coverage.
I’m using Jest, and I ran the following for produce LCOV and JUnit reports:

  • jest --ci --reporters=default --reporters=jest-junit
  • jest --coverage

I have junit.xml under my project root directory, and coverage/
My Sonar config is including just


because I saw that “sonar.junit.reportspath” is deprecated, but couldn’t find which setting should replace it.
I’m running Sonar manually and see the following output:

INFO: Sensor SonarJS Coverage [javascript]
INFO: Analysing [..../coverage/]
WARN: Invalid character encountered in file ...../src/scenes/welcome/assets/images/logo_color.png at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
WARN: Could not resolve 2 file paths in [......./coverage/], first unresolved path: ......../config/jest-framework.js
INFO: Sensor SonarJS Coverage [javascript] (done) | time=28ms

Hi Vitaly,

Welcome to the community!

Indeed sonar.junit.reportPath (without the s) is deprecated but you can use sonar.junit.reportPaths instead.

Looking at the output you shared it’s weird to see that there are some png files encountered while analysing your lcov files… Could you share your whole files ?

Good point, thanks!

I started from empty one, now I have


Ok, it does looks correct indeed.
Is it a public project ? Could share a link to the repo and the sonarcloud page in a DM so that I can have a closer look ?

No, it’s private one.
I’ll send you detail via PM. Oops, there is no message option…

Any solution to this?

I don’t remember exactly fixes, but coverage works now, and here is my sonar config: