
Question:
I want to provide a coverage report for a ui
project.
The project mainly consists of .ts
files which under version control.
The gulp
command used to check coverage, generates .js
files which are then checked for coverage. (and a coverage report that ... reports <strong>only</strong> on those files)
The .js
files are not under version control and, when produced are intermingled with the .ts
files (i.e., wherever there is a .ts
file, a .js
file will be generated next to it).
This creates the following issue:
When sonarqube
generates coverage report, to my report above (pointed to by sonar.javascript.lcov.reportPaths
), the .ts
files are added (which of course have 0.0%
coverage) and this breaks the actual cov value.
Is there a way / pattern to instruct sonarqube to:
a) perform code analysis on .ts
files
b) ignore <strong>all</strong> .ts
files when generating coverage report?
Just found out in the <a href="https://docs.sonarqube.org/display/SONAR/Narrowing+the+Focus#NarrowingtheFocus-IgnoreCodeCoverage" rel="nofollow">project's documentation</a>.
<blockquote><strong>Ignore Code Coverage</strong>
You can prevent some files from being taken into account for code coverage by unit tests.
To do so, go to Administration > General Settings > Analysis Scope > Code Coverage and set the Coverage Exclusions property
</blockquote>There is also the following directive that can be used in the sonar-project.properties
file:
sonar.coverage.exclusions