Skip to content
This repository has been archived by the owner on Dec 31, 2019. It is now read-only.

How to skip statements/functions? #24

Closed
dtinth opened this issue Mar 5, 2015 · 27 comments
Closed

How to skip statements/functions? #24

dtinth opened this issue Mar 5, 2015 · 27 comments

Comments

@dtinth
Copy link

dtinth commented Mar 5, 2015

This function is only called when there is an error (it displays an error dialog on web page). It is not useful to test the coverage of this function.

screen shot 2015-03-05 at 17 11 26

In Istanbul, you could use /* istanbul skip next */, but it doesn't work in Isparta. I also tried /* isparta ignore next */ without success.

@bassettsj
Copy link

Having the same problem. Would be great to allow the same Ignoring Code For Coverage Spec for isparta.

@kentcdodds
Copy link

I'm also experiencing the same issue. @bassettsj, if I'm not mistaken, it's not that isparta needs an "Ignoring Code For Coverage Spec" because it actually uses istanbul behind the scenes. I think this is simply a bug in isparta that somehow istanbul isn't seeing those comment annotations... Is that right @douglasduteil?

@pawelbrzezinski
Copy link

Same here.

@chpio
Copy link

chpio commented Jun 24, 2015

+1

@kentcdodds
Copy link

@douglasduteil, if you have any idea what the issue might be and where it could potentially be solved and perhaps give some direction on making a PR, I would be happy to contribute a PR.

@andrewzey
Copy link

+1. This is quite problematic. I'll see if I can contribute a fix for this soon.

@chpio
Copy link

chpio commented Jul 8, 2015

$ 10 added
Bountysource

@kentcdodds
Copy link

$100 added :-)

@andrewzey
Copy link

Wow ok. I'll give this a shot today.

@amitev
Copy link

amitev commented Jul 23, 2015

Any progress with this?

@douglasduteil
Copy link
Owner

Hum sorry guys but I prefer investing my time in merging with Istanbul #31

@chpio
Copy link

chpio commented Jul 23, 2015

hmm, is there a way to transfer a bounty to another issue?

@amitev
Copy link

amitev commented Aug 31, 2015

Any news on that. Looks like the merging with Instanbul doesn't go smoothly...

@kentcdodds
Copy link

Another $100 added. I would totally accept this (and prefer it) if the merger with Istanbul is successful.

@curiouslychase
Copy link

Based on the commit history continuing to grow and the last comment on #31 was over 2 months ago, is it safe to assume this issue could still be resolved in the isparta project?

I did some investigating today and it seems like the problem is that babel transforms the code and the AST it produces is not being correctly parsed by istanbul?

@kentcdodds
Copy link

Fantastic news! I'll award the contributor my bounty when I get a chance to test this out on Monday. This is awesome!

@douglasduteil
Copy link
Owner

@kentcdodds Keep me posted on this.
I currently have no test project to really test this out

@taion
Copy link
Contributor

taion commented Oct 31, 2015

@taion
Copy link
Contributor

taion commented Oct 31, 2015

There is (of course) a caveat here - something like istanbul ignore next for a method on an ES6 class will only work if you're using loose mode. Otherwise Babel transpiles the code in such a way that the pragma comment no longer references the method.

@kentcdodds
Copy link

@TheMcMurder, if you're not doing anything this weekend and want to bump our code coverage big time, you might try upgrading isparta and seeing if this works for us :-)

@TheMcMurder
Copy link

Tested it in out project. Works great.

@kentcdodds
Copy link

@taion, please claim the bounty here: https://www.bountysource.com/issues/9221471-how-to-skip-statements-functions I'll then be able to award you the $200 that I've placed on this issue. Thanks!

@amitev
Copy link

amitev commented Nov 7, 2015

Which version of isparta should I use in order to get the /* istanbul ignore next */ working?

@taion
Copy link
Contributor

taion commented Nov 7, 2015

Looks like v3.2.0 or later.

@amitev
Copy link

amitev commented Nov 7, 2015

I ask because I'm using 3.5.3 and it doesn't work.

@taion
Copy link
Contributor

taion commented Nov 7, 2015

Check your transpiled code - this isn't doing anything beyond plumbing everything through. If Babel moves your comment somewhere away from the block you want to ignore, then nothing's going to happen.

This is most relevant for something like method declarations in ES6 classes - you'll need to use "loose": "all" there.

@amitev
Copy link

amitev commented Nov 8, 2015

That worked. Thank you very much!

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

No branches or pull requests