Hi,
I was following this guide to set up my coverage reports: Narrowing the Focus | SonarQube Docs
My repo uses a modern style where test files are intermingled with source files, so I ended up with something like the suggestion from the guide:
# Define the same root directory for sources and tests
sonar.sources = src/
sonar.tests = src/
# Include test subdirectories in test scope
sonar.test.inclusions = src/**/test/**/*
# Exclude test subdirectories from source scope
sonar.exclusions = src/**/test/**/*
However, sonar keeps asking for coverage for my .spec.ts
files.
I have tried several configurations, including sonar.coverage.exclusions
but it is always asking me to cover my spec files.
example folder structure
- libs
- some_lib
- __test__
- index.spec.ts
- index.ts
## Define the same directory for sources and tests
sonar.sources=apps/,libs/
sonar.tests=apps/,libs/
## Include in test scope: test+mock files/subdirectories
sonar.test.inclusions=[apps,libs]/**/__test__/**/*
## Exclude from source scope: test+mock files/subdirectories, generated libs
sonar.exclusions=[apps,libs]/**/__test__/**/*,./libs/api-migrations/**,./libs/api-client/**,
## Exclude from coverage: test+mock files/subdirectories
sonar.coverage.exclusions=[apps,libs]/**/__test__/**/*