JS coverage doesn't work anymore

Hello,

we are using SonarCloud to analyse an AngularJS project, we used to have coverage report by using sonar.javascript.lcov.reportPaths property but it doesn’t work anymore since yesterday.
From what I can see in scanner context, JS plugin was updated from SonarJS 5.1.1.7506 to SonarJS 5.2.0.7766.
I didn’t find anything in release note, do you know if we need to change our config and how ?

Thanks for your help !

4 Likes

I have observed the same. The scanner warns Could not resolve NN file paths in ... where NN is all my files.

I haven’t found any workaround yet for SonarCloud.

Hi @rudy-henon,
In fact, we did change something about LCOV reportPath, but it should be backward compatible (hence, not impacting current configuration).

Could you please share with us what are you using as sonar.javascript.lcov.reportPaths property? Is your project multi-language? Could you please attach the logs?

@sasjo is your problem related to coverage report path? If not, could you please create a separate thread?

Andrea.

Same stuff for us.

We don’t have any reportPaths settings, it worked by default from /coverage directory.

Now it’s 0% coverage on all repositories.

Settings sonar.javascript.lcov.reportPaths doesn’t change anything and version of sonar-scanner wasn’t updated on our end for a long time.

I assume something on sonarcloud.io can be ignoring coverage reports.

Please do something about this.

UPD. running sonar-scanner with debug on:

16:46:26.883 INFO: Sensor SonarJS Coverage [javascript]
16:46:26.883 INFO: 253/253 source files have been analyzed
16:46:26.884 INFO: Analysing [/./coverage/lcov.info]
16:46:26.888 WARN: Could not resolve 106 file paths in [/./coverage/lcov.info], first unresolved path: /components/AdditionalOptions/AdditionalOptions.js

UPD2. Changing absolute path inside coverage.lcov to relative will bring coverage back.

UPD3. Guys use:
sed -i.bak 's#'pwd/'##g' ./coverage/lcov.info
in your build to strip absolute paths, this should help in meanwhile.

@rudy-henon, @sasjo, @cursedcoder ,
thanks for reporting, I managed to reproduce the issue.
We will release a bugfix asap.

Andrea

1 Like

Hi @Andrea_Guarino,

I am using the following property sonar.javascript.lcov.reportPaths=reports/unit-tests/coverage/lcov/lcov.info. The project uses JavaScript, CSS and HTML languages. Please find scanner logs attached.

Rudyscanner.txt (5.7 KB)

Hi we have the same issue since yesterday, our project use React Native whit jest
this is our configurations:

sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.testExecutionReportPaths=reports/test-report.xml
sonar.dynamicAnalysis=reuseReports

Hi we have the same issue since, our projet use “nodejs” whit “mocha” and “nyc”
this is our configurations:

sonar.dynamicAnalysis=reuseReports
sonar.javascript.lcov.reportPaths=(FOLDER_PATH)/(lambda_name)/.test_output/coverage/lcov.info

Hello,
we released SonarJS 5.2.1 that should solve your issues on coverage.
It will be available soon on SonarCloud.

Andrea

Hi Andrea,

thanks for your swift fix !!

Hi Andrea,

Please can you notify us when available making on SonarCloud

hello @Guillaume_MERVAUX , it is deployed on SonarCloud already.

1 Like

Thank goodness that I found this thread. I was having this issue some minutes ago and with the plugin update it got fixed.

Thanks a lot!