Javascript coverage and nyc excludes

javascript
coverage

(yonatan weiss) #1

which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

sonarqube 7.7, sonarJS

what are you trying to achieve

I’ve got a file in my nyc which have some excludes and some includes for coverage results.
I want to make Sonarqube use these excludes and these includes when getting the coverage report, without specifying in two places (the nyc and sonarqube properties file) which files to exclude. is there a way to make sonarqube read the exclude positions from the .nycrc.json file?

what have you tried so far to achieve this:

  • I’ve tried to exclude it in both files but this is a bad solution.
  • Currently I’ve though about creating some hack by running a python script which gets the excluded files from the nyc excluded section and give them as input to the sonar-scanner…

Is there a better solution?

Thanks.


(Elena Vilchik) #3

Hi @yonatanw

Unfortunately there is no way to automatically “sync” coverage configuration. So far SQ can only rely on your gitignore to exclude some files from analysis.

Regards,
Lena