I am scanning a ui
project.
The source code is in typescript
.
gulp test-coverage
generates .js
files (which are then scanned for coverage). (each .ts
file gets a .js
file right next to it, in the same location)
I am pointing the scanner to the lcov.info
file as follows:
sonar.javascript.lcov.reportPaths=test-coverage/lcov.info
The problem:
The lcov.info
, provides coverage information for .js
files
For some reason, SonarQube also provides coverage information for the *.ts
files (although not incorporated
in the test coverage report).
Why is that?
If I explicitly use
sonar.inclusions=**/*.ts
or
sonar.language=ts
the .js
files will be ignored from the coverage report
If I use
sonar.coverage.exclusions=**/*.ts
and no specific inclusions, this will lead to both the .ts
and .js
files being scanned for errors, which will end up in duplicate errors (after all, .js
files are generated by their .ts
counterparts.
Any suggestions?
The whole issue of course would just go away, if sonarqube took litteraly the lcov.info
and did not take initiatives about scanning other files.)
If your source code is written in TypeScript, the coverage report (lcov.info
) must contain information about TypeScript files, and not compiled JavaScript. The property you must be using in this case is sonar.typescript.lcov.reportPaths
.
You can check out this example (https://github.com/SonarSource/SonarTS-example) to get more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With