-
Notifications
You must be signed in to change notification settings - Fork 105
SonarQube reports 0% coverage for interface files, whereas interfaces can't actually be tested. #169
Comments
AFAIK this plugin does not count coverage at all. @Pablissimo please, correct me, if I'm wrong |
Additionally, some discussions with other teams at my organization revealed that the better practice is to NOT create interface.ts files (specifically because they can't be tested), and to instead declare interfaces in a typings file. This allowed us to drop all of those interface files with 0.0% coverage |
Interfaces in a typings file isn't something I've come across, I'm stealing that idea for work! The trouble is that the plugin knows nothing about TypeScript as a language, beyond how to count commented lines. I was going to integrate basic lexing to be able to detect code that's not really executable (like interfaces, or the uncovered conditions you get in class and module definitions) but news then came that there'll be an official TypeScript plugin built by SonarSource and I didn't want to commit time to doing it if it was going to immediately be made redundant by an official plugin. At the minute that official plugin doesn't seem to do coverage that I can tell, just linting so maybe it's time to see. The suggestion of using the TypeScript compiler itself to determine this stuff came up and is a goody, so still happy to explore that assuming there's no plans on the official plugin to do coverage. |
@nixel2007 I'm also not able to pull any coverage values from my lcov file, even after specifying it's path. Is there anything else required to make it work @Pablissimo ? Logs: |
You can check my vscode+istanbul lcov setup here - https://github.com/xDrivenDevelopment/vsc-language-1c-bsl |
Karma/Istanbul correctly leaves out interface files, because they are inherently not testable, however the SonarTsPlugin lists those interface files as having 0% coverage, which is bringing our overall coverage percentage down below the 90% coverage required by our devops team to deploy.
accordion.interfaces.ts
Istanbul
(showing coverage for all relevant files in directory)
SonarQube
(showing coverage for all relevant files in directory)
The text was updated successfully, but these errors were encountered: