Setting sonar scanner exclusions

Hi,
trying to setup sonar scanner with some similar requirements, the basic setup is working, but when I am trying to exclude few files from sonar coverage, its not working.
I went through the links/docs in this topic chain, but not able to figure out how to exclude couple of particular specific files
I want to exclude below bold files and include rest


  • src
    • home
      • home.js
      • home.spec.js
    • user
      • user.js
      • user.spec.js
        - - index.js
        - - serviceWorker.js

In sonar properties I have:

...
sonar.language=js
sonar.sources=src
sonar.tests=src
sonar.test.inclusions=**/src/**/*.spec.js,**/src/**/*.spec.jsx,**/src/**/*.test.js,**/src/**/*.test.jsx
sonar.exlusions=src/*.js  *<--to exclude the src/index.js and src/serviceWorker.js*
sonar.javascript.lcov.reportPaths=./unit-tests-results/coverage/jest/lcov.info
sonar.javascript.file.suffixes=.js,.jsx
...

with above settings, sonar still shows the files to be excluded in coverage report having 0 coverage.
scratching my head :thinking:, pls help/point if you see anything I am missing or not setting correct?

got it working, I had to replace sonar.exclusions with sonar.coverage.exclusions

this reply in the other thread helped

1 Like