Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typescript code coverage of multiple __extends declarations

When it compiles my code, TypeScript includes an __extends declaration at the top of every file:

var __extends = this.__extends || function (d, b) {
    /* istanbul ignore next */
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};

This works fine behind-the-scenes, but it creates an inconsistency when it comes to using something like karma-coverage to generate reports. This declaration contains two function calls and a branch in the code (the || usage), which only ever get exercised on the first declaration, leaving dozens (if not hundreds) of subsequent declarations for which there is no coverage. This makes a file with otherwise 100% code coverage look sorely uncovered in the coverage reports.

Has anyone solved this problem?

like image 472
stolli Avatar asked Jun 16 '26 05:06

stolli


1 Answers

I found a work item at the typescript codeplex. I hope the typescript guys solve this issue soon. You can find more on that here: typescript workitem 2002

like image 155
tschoartschi Avatar answered Jun 18 '26 23:06

tschoartschi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!