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 · 13 comments · Fixed by #648
Assignees
Labels
bug
Milestone

Comments

@garthk
Copy link

@garthk 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

This comment has been minimized.

Copy link
Contributor

@feugy 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

This comment has been minimized.

Copy link
Member

@geek 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

This comment has been minimized.

Copy link

@mmc41 mmc41 commented Aug 5, 2016

Also interested in a fix for this.

@d3viant0ne

This comment has been minimized.

Copy link

@d3viant0ne d3viant0ne commented Oct 1, 2016

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

This comment has been minimized.

Copy link

@danielo515 danielo515 commented Feb 6, 2017

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

This comment has been minimized.

Copy link
Author

@garthk 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 in #648 Mar 3, 2017
@danielo515

This comment has been minimized.

Copy link

@danielo515 danielo515 commented Mar 6, 2017

Why have you closed this issue? is it resolved ?

@Marsup

This comment has been minimized.

Copy link
Member

@Marsup Marsup commented Mar 6, 2017

It's written on the close event.

@AdriVanHoudt

This comment has been minimized.

Copy link
Contributor

@AdriVanHoudt AdriVanHoudt commented Mar 6, 2017

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

@feugy

This comment has been minimized.

Copy link
Contributor

@feugy 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

This comment has been minimized.

Copy link

@danielo515 danielo515 commented Mar 7, 2017

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

@Marsup

This comment has been minimized.

Copy link
Member

@Marsup Marsup commented Mar 7, 2017

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

@geek

This comment has been minimized.

Copy link
Member

@geek geek commented Mar 11, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants
You can’t perform that action at this time.