-
-
Notifications
You must be signed in to change notification settings - Fork 358
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
No coverage analysis when running sub-command on Windows #300
Comments
Do you have some kind of public reproduction of your problem? Usually nyc should be able to handle this situation. |
@addaleax: I just pushed a repo to reproduce the issue. There are two 1:
2:
|
Could you try this patch in diff --git a/lib/win-rebase.js b/lib/win-rebase.js
index 3436c28327b2..0242b5f4a014 100644
--- a/lib/win-rebase.js
+++ b/lib/win-rebase.js
@@ -1,8 +1,18 @@
var re = /^\s*("*)([^"]*?\b(?:node|iojs)(?:\.exe)?)("*)( |$)/
+var npmre = /^\s*("*)([^"]*?\b(?:npm))("*)( |$)/
+var which = require('which')
+var path_ = require('path')
module.exports = function (path, rebase) {
var m = path.match(re)
- if (!m) return path
+ if (!m) {
+ m = path.match(npmre)
+ if (!m) return path
+ var npmPath = 'npm'
+ try { npmPath = which.sync('npm') } catch(e) {}
+ npmPath = path_.dirname(npmPath) + '\\node_modules\\npm\\bin\\npm-cli.js'
+ return path.replace(npmre, m[1] + rebase + ' "' + npmPath + '"' + m[3] + m[4])
+ }
// preserve the quotes
var replace = m[1] + rebase + m[3] + m[4]
return path.replace(re, replace) This seems to make your reproduction repository work for me. |
Nice! With that patch applied to Let me know if I can be of any help with testing/reproduce anything else. |
great find @addaleax! was this a regression? or an edge-case we'd missed? |
@bcoe This kind of looks like a slightly different variant of #190 for Windows, nothing actually new. You did the spawn-wrap tests for that one with I’m doing all the Windows stuff through a VM and it’s been a while since I did a lot of Windows work. Also, I’m not sure… I’m feeling like my patch above would definitely mean relying on |
@addaleax we already have this logic in https://github.com/tapjs/spawn-wrap/blob/master/index.js#L211 I think it would be reasonable to add your patch, but we should probably try to share the logic? what do you think. I agree let's get tests running on AppVeyor for as much of this functionality as possible, I also only run a VM. |
@bcoe Yes, that would be share-able… I’ll try to get some tests for this together later today if you don’t beat me to it. ;) |
Fixes a variant of istanbuljs/nyc#190 for Windows when the `npm.cmd` shim is invoked from the shell (i.e. `cmd /s`). Fixes: istanbuljs/nyc#300
Fixes a variant of istanbuljs/nyc#190 for Windows when the `npm.cmd` shim is invoked from the shell (i.e. `cmd /s`). Fixes: istanbuljs/nyc#300
Fixes a variant of istanbuljs/nyc#190 for Windows when the `npm.cmd` shim is invoked from the shell (i.e. `cmd /s`). Fixes: istanbuljs/nyc#300
Fixes a variant of istanbuljs/nyc#190 for Windows when the `npm.cmd` shim is invoked from the shell (i.e. `cmd /s /c`). Fixes: istanbuljs/nyc#300
So I've got an issue that I think I can isolate down to these two scenarios:
1: Running my tests directly from within the
nyc
command; e.g.:nyc ava --verbose
or annpm
script calledcover
with the same contents (nyc ava --verbose
).2: Running my tests indirectly via an npm script (the
test
script containsava --verbose
); e.g.:nyc npm test
or annpm
script calledcover
with the same contents (nyc npm test
).It seems like the
nyc
process isn't picking up the coverage information when there's another level of indirection.System Specs
OS: Windows 10 Pro N
Node: 6.2.2
npm: 3.8.3
nyc: 6.6.1
ava: 0.15.2
The text was updated successfully, but these errors were encountered: