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

Test coverage shows untransformed output #614

Closed
garthk opened this issue Jul 1, 2016 · 14 comments · Fixed by #648
Closed

Test coverage shows untransformed output #614

garthk opened this issue Jul 1, 2016 · 14 comments · Fixed by #648
Assignees
Labels
bug Bug or defect
Milestone

Comments

@garthk
Copy link

garthk commented Jul 1, 2016

lab -T test/lib/transform-tsc.js test -v -S -c -r html -o cov.html produces a coverage file with:

  • Correct test results
  • Correct pre-transform filenames, e.g. index.ts in the navigation bar and code coverage report headers
  • Correct coverage information, e.g. reporting "condition always false"
  • The post-transform file contents, not the expected pre-transform file contents

lab -T test/lib/transform-tsc.js test -v -S with a failing test produces correct line numbers for pre-transformed code.

Reproduction repository: garthk/lab-coverage-vs-sourcemaps-typescript-edition

See also: #338

I'm hoping this is a configuration problem, in which case I'm happy to have pitched in with typings for code and lab and a skeleton project for anyone trying to drive them from TypeScript and Visual Studio Code.

@feugy
Copy link
Contributor

feugy commented Jul 18, 2016

I encounter exactly the same problem with babel transformer.
It seems to be the way that html reporter is written:

It output the post-transform code, and just add information on original line and filename as a tooltip.

That is said, it's not really the behaviour a user expect from that kind of report. @geek, do you already have plan in mind ? I'll be glad to do a PR to improve that.

@geek
Copy link
Member

geek commented Jul 20, 2016

@feugy no plan in mind from me, please do fix with a PR if you have the time. Thanks!

@mmc41
Copy link

mmc41 commented Aug 5, 2016

Also interested in a fix for this.

@joshwiens
Copy link

I'll see if I can work this out with @garthk / @feugy in the next few weeks as all of our new server side Node work is Hapi / TypeScript and proper pre-transform coverage is optimal.

@danielo515
Copy link

Dear @garthk ,

How did you ended using to that configuration? I looked through the entire internet to find how to test typescript code with lab and I didn't find any information. Thank god you have opened this issue.

Regarding the coverage report, I'm getting coverage information of the compilled code. Using es6 as target instead of es5 would definitely help to get a closer view of the source.

Have you noticed that the issue you referenced microsoft/TypeScript#7980 has been closed?

@garthk
Copy link
Author

garthk commented Feb 7, 2017

Yep! lab-transform-typescript now loads your tsconfig.json using TypeScript's own machinery. It also forces inline source maps so line numbers in tracebacks are OK with lab -S. The source code is still hard to read. As you point out, using an es6 target helps; I'm looking forward to Node 8 so I can safely set target to es2017 in TypeScript 2.1; see also node.green.

@geek geek added this to the 13.0.0 milestone Mar 3, 2017
@geek geek self-assigned this Mar 3, 2017
@geek geek closed this as completed in #648 Mar 3, 2017
@danielo515
Copy link

Why have you closed this issue? is it resolved ?

@Marsup
Copy link
Contributor

Marsup commented Mar 6, 2017

It's written on the close event.

@AdriVanHoudt
Copy link
Contributor

The close event being -> @geek geek closed this in #648 3 days ago

@feugy
Copy link
Contributor

feugy commented Mar 6, 2017

@danielo515 I'll be glad to have someone else testing this, so if you can run it against your codebase, any feedback will be appreciated.

@danielo515
Copy link

Sure @feugy ,
The version that has the fix is the 13.0.0 right?

@Marsup
Copy link
Contributor

Marsup commented Mar 7, 2017

Version 13 is not released yet, you'll have to test it from master.

@geek
Copy link
Member

geek commented Mar 11, 2017

v13.0.0 is now published! Here are the release notes: #684

@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug or defect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants