Is it possible to narrow coverage to a specified set of files?

Hello, i’m starting to implement tests on my nodejs project using jest, but i only want to gather coverage for a specific set of files, like only for service files for example. This is possible using jest coverage by setting collectCoverageFrom on jest.config but when sonar gathers the coverage reported by jest it calculates the total coverage by counting every file analyzed in the project.

I know you can exclude a set of files from coverage report by using sonar.coverage.exclusions , but i want to do the oposit of that, where i could specify the exact set of files that should be covered by tests on my project.

Hi,
When you exclude a file with jest, does it show up in the jest’s coverage report with no coverage? If it’s present at all in the report, I’d assume that SonarQube doesn’t assume it has no coverage.