-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emitted code for super() results in 'Branch not covered' in coverage reports. #13029
Comments
This is to support subclassing classes which themselves return different objects from |
@RyanCavanaugh. OMG, had she died, Barbara would turn in her grave. Is this in the ES6 standard? Because this looks to me like OOP on LSD. |
It's a thing (tm), unfortunately > class Tricky { constructor() { return { m: 4 } } }
[Function: Tricky]
> let t = new Tricky();
undefined
> t
{ m: 4 }
> class Mine extends Tricky { constructor() { super(); } }
[Function: Mine]
> let m = new Mine();
undefined
> m
{ m: 4 }
> m instanceof Mine
false |
Also linking to SitePen/remap-istanbul#106 in case that can fix the issue. |
@Bnaya, this seems like a good feature to add. do you mind filing a new issue to track it. |
I don't feel i know enough about it, i just gave the hint:) |
@Bnaya wouldn't that ignore everything?! Seems so wrong to do :) |
As mentioned in #13455 (comment), instead of the various workarounds proposed, it is better to simply stick to |
For the one using webpack and TypeScript configured to output ES5, |
TypeScript Version: 2.1.4
Code
The
super()
call in the following code, results in 'Branch not covered' with Istanbul (see issue).In Typescript 1.8 the
super()
call transpiled to:But in 2.1.4 it transpile to:
Which will obviously yield 'Branch not covered'.
Adding a test - or ignore instructions - just to ensure appropriate coverage does not feel right here, let alone will have to include some comments on the internals of typescript.
The text was updated successfully, but these errors were encountered: