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
fix: Add ts-ignore to reassignment of generated function #557
Conversation
What's the required process to see this merged? |
Any idea if you can install git subdirectories as npm packages? I might need to |
Ok, I can confirm I've tested this branch (using Will also test with my real repo. |
I'm now seeing this issue: instrumented/Text.ts:5852:3 - error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties, parameter properties, or private identifiers.
5852 constructor(props: ConstructObj = (cov_25gnjz1tfh().b[0][0]++, null)) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5853 cov_25gnjz1tfh().f[0]++;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
5869 this.loadFonts();
~~~~~~~~~~~~~~~~~~~~~
5870 } When instrumenting this code: constructor(props: ConstructObj = null) {
super();
if (props) {
this.original = props;
this.set(props);
}
this.loadFonts();
} |
@jedateach I should be able to merge / release this soon. As for TS2376 there is currently no fix, see microsoft/TypeScript#8277 and microsoft/TypeScript#29374. Take the following example: class A {
constructor(public p: string) {
super();
this.otherProp = '1';
}
} Instrumented: class A {
constructor(public p: string) {
cov_1zjww7ja73.f[0]++;
cov_1zjww7ja73.s[0]++;
super();
cov_1zjww7ja73.s[1]++;
this.otherProp = '1';
}
} We must increment the On your own project you might be able to work around this by running |
Thanks for the tip - I'll give it a go. Would be really great to have an established pattern for Typescript projects to be checking coverage. I'm surprised Microsoft hasn't dedicated some effort to coverage, either by helping this project or doing their own. ...Unless I've missed something. I'm new to TS. |
In my case, I'm running the tests in Testem, not node. This means I need to instrument in an isolated step. Is it possible to achieve the same as I've been thinking it'd be a matter of getting |
Looks like the Typescript team (2013) just test coverage using the produced JS. https://stackoverflow.com/a/17028570/918605 |
I'm pretty sure you can use Testing coverage of the generated JS works but |
istanbul-lib-instrument@4.0.2 is released to npm on the |
I've now attempted this, and even though the required modules appear be loaded, the output produced is always typescript. I'm not sure how to get
|
I can take a look if you post a minimal demo repository. Keep in mind I'm not a TS developer so be sure to include whatever is required for |
Fixes istanbuljs/nyc#1292