SonarQube detects code coverage for unit test file

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) : SonarQube enterprise
  • how is SonarQube deployed: zip, Docker, Helm : On premise
  • Ask: We have typescript code base and created unit test (.spect.ts files), sonarqube detects code coverage are missing for unit test files.

Does sonarqube intelligent enough to detect unit test files or we have to specify in sonar.exclusion?

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hey there.

You will need to configure your analysis scope to index these files as tests.

If your .spec.ts files live right next to your source files (not in a separate directory), the easiest way to do this would be to set:

sonar.tests=. # equivilant to what is set for sonar.sources if explicitly set