-
-
Notifications
You must be signed in to change notification settings - Fork 360
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
Don't try to cover the bin/nyc.js file #138
Conversation
This makes it possible to self-test node-tap's coverage reporting and coverage level checking when running in covered mode. Otherwise, doing `node {nycBin} check-coverage` results in executing the nyc executable script as the main file (or worse, some module named `check-coverage`, which obviously doesn't exist).
This is a cleaner solution to the issue caused by spawning the nyc bin from a test that is currently covered. Also avoids having competing arg-parsing between yargs (better for program arguments, user-flags, and such) and spawn-wrap, which just splices off a set count of positional arguments from the array.
Checking for 'report' anywhere in the command means that something like nyc my-thing which-is-not-nyc report would end up running nyc's reporter instead of my thing.
Added another 2 commits with a cleaner (imo) approach. Now coverage should not interfere with running nyc itself, and nyc can cover things with Still not sure why it doesn't work to cover nyc with nyc, though. |
We moved away from that because there are just too many (potentially) overlapping parts:
Too many potential traps. It's easier to just use the manual method we currently are. |
Fair enough. But I still want to have node-tap be able to spawn nyc and have it able to run a report or coverage-check while coverage is enabled, so that I can get more test coverage of node-tap. You could get around the conflicting NYC_CWD environ by not relying on an environment variable for that. If a positional argument was passed to spawn-wrap, it'd be able to have as many of those as necessary, and un-wrap at each level. Even if it was wrapped 50 times, it'd get progressively slower of course, but the wrapping would be fine, and could be using a different NYC_CWD at each level. Nesting require extensions would be tricky, but wasn't there something in the works to support that anyway, for babel and such? |
It's in already ( |
That makes sense. This enables that, correct? |
@jamestalmage if this pull makes it easier to test tap, I see no reason not to land it; I'd like to test thoroughly though -- requiring that |
I'm not opposed to landing it. I was just providing background. I haven't reviewed yet (on mobile). So I can't comment on if it's a breaking change. But if what you say is true, then yeah. |
Yargs will already pull out --flags from the _ array. So this would only change |
LGTM. I like the use of |
@bcoe lgty? |
@isaacs smoke tests look good, merging; I'll let you know once a release has gone out. |
Don't try to cover the bin/nyc.js file
@isaacs if you give the next branch of
|
This makes it possible to self-test node-tap's coverage reporting and
coverage level checking when running in covered mode. Otherwise, doing
node {nycBin} check-coverage
results in executing the nyc executablescript as the main file (or worse, some module named
check-coverage
,which obviously doesn't exist).