Open raghanag opened 5 years ago
I am working on something very similar right now and seeing the same discrepancy. I believe my issue is caused by two things so you may be experiencing these too:
sonar.coverage.exclusions
for this, but the exact name may depend on Sonar version.Maybe this plugin can help: https://github.com/kopach/karma-sabarivka-reporter
Hi I am having a strange issue when generating code coverage with karma-coverage. My source files are written in typescript where as the test files are written in javascript with qunit being the test framework. When I run the karma start, all my tests are getting passed and the code coverage report being generated. But the istanbul report and the lcov.info which I am using sonarqube to view the code coverage are showing different reports.
For example, in html report by istanbul even though the source file is in ts, the code coverage shown in transpiled js file with all of the code is covered except the awaiter and generator functions which will be generated when we use Promises in typescript, since we are using the target as es-5.
The Istanbul report is showing as 65% lines coverage, but in Sonar the coverage is showing as 17%, please note that with the below coverageReporter configuration, it generates the lcov.info report which I am using it to publish it to sonar.
The Sonar dashboard is displaying the ts file as-is not in the transpiled/javascript code.
Here is the karma-config.
sonar-project.properties