Skip to content
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

Errorneous coverage skipped report #727

Closed
sramam opened this issue Nov 20, 2017 · 3 comments
Closed

Errorneous coverage skipped report #727

sramam opened this issue Nov 20, 2017 · 3 comments

Comments

@sramam
Copy link

sramam commented Nov 20, 2017

Please use the template provided below, when reporting bugs:

Expected Behavior

This coverage report has a missing line of coverage. In fact, it's only the trailing semi-colon
that get's reported as having been skipped. This is after the reversing of a source-map to TypeScript.

Unsure this is a problem with nyc, istanbul or the sourcemap reverse mapping.

Observed Behavior

https://coveralls.io/builds/14286562/source?filename=src%2Findex.ts#L20

Bonus Points! Code (or Repository) that Reproduces Issue

git clone https://github.com/tufan-io/data-check
npm i
npm run build
open coverage/index.html 

Navigate to coverage/index.ts.html to see the issue.

Forensic Information

Operating System: the operating system you observed the issue on.
Similar issue observed on OSX and ubuntu.

Environment Information: information about your project's environment, see instructions below:

  1. run the following script:

sh -c 'node --version; npm --version; npm ls' > output.txt

  1. share a gist with the contents of output.txt.

https://gist.github.com/sramam/3d7543fb7444f2f95ec05a2abc4770ef

@bcoe bcoe added the triaged label Jan 2, 2018
@bcoe
Copy link
Member

bcoe commented Jan 2, 2018

You're correct, looks like it's a missing single branch (the semicolon) rather than the line itself.

The problem appears to be as follows:

_this = _super.call(this, msg) || this;

typescript represents a call to super() like so ☝️, so || this will never execute. @DanielRosenwasser any thoughts on this subject? It would be nice for folks to be able to collect coverage for this scenario -- is there another way the above logic could be implemented, such that coverage is possible?

@DanielRosenwasser
Copy link

DanielRosenwasser commented Jan 4, 2018

Check out microsoft/TypeScript#13029; the bottom comment by @ben8p seems to mention this Webpack plugin: https://www.npmjs.com/package/ts-es5-istanbul-coverage

Though admittedly that might perfectly help.

@sramam
Copy link
Author

sramam commented Jan 7, 2018

thanks for the pointer @DanielRosenwasser. Looks like emitting es5 code exposes the issue - and emitting es6 hides it.

Since there is not much anyone can do, will update tsconfig.json and pretend the issue went away!
Linking here in case others stumble upon the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants