Skip to content

Commit

Permalink
Merge pull request #38 from strongloop-forks/fix-windows-spawn
Browse files Browse the repository at this point in the history
Fix windows spawn
  • Loading branch information
bcoe committed Aug 2, 2015
2 parents 457999c + 16f1535 commit 31f65b9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion bin/nyc.js
Expand Up @@ -81,8 +81,9 @@ if (process.env.NYC_CWD) {
report(argv)
} else if (~argv._.indexOf('check-coverage')) {
foreground(
require.resolve('istanbul/lib/cli'),
process.execPath,
[
require.resolve('istanbul/lib/cli'),
'check-coverage',
'--lines=' + argv.lines,
'--functions=' + argv.functions,
Expand Down
11 changes: 10 additions & 1 deletion index.js
Expand Up @@ -145,8 +145,17 @@ NYC.prototype.tmpDirectory = function () {

NYC.prototype.mungeArgs = function (yargv) {
var argv = process.argv.slice(1)
argv = argv.slice(argv.indexOf(yargv._[0]))
if (!/^(node|iojs)$/.test(argv[0]) &&
process.platform === 'win32' &&
(/\.js$/.test(argv[0]) ||
(!/\.(cmd|exe)$/.test(argv[0]) &&
!fs.existsSync(argv[0] + '.cmd') &&
!fs.existsSync(argv[0] + '.exe')))) {
argv.unshift(process.execPath)
}

return argv.slice(argv.indexOf(yargv._[0]))
return argv
}

module.exports = NYC
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -13,7 +13,7 @@
"config": {
"nyc": {
"exclude": [
"node_modules/"
"node_modules"
]
}
},
Expand Down
4 changes: 2 additions & 2 deletions test/nyc-test.js
Expand Up @@ -33,7 +33,7 @@ describe('nyc', function () {

var nyc = new NYC()

nyc.cwd.should.match(/nyc\/test\/fixtures/)
nyc.cwd.should.equal(path.resolve(__dirname, './fixtures'))
afterEach()
})
})
Expand Down Expand Up @@ -241,7 +241,7 @@ describe('nyc', function () {
})
nyc.wrap()

istanbul.config.loadFile.calledWithMatch('test/fixtures/.istanbul.yml').should.equal(true)
istanbul.config.loadFile.calledWithMatch(path.join('test', 'fixtures', '.istanbul.yml')).should.equal(true)
istanbul.Instrumenter.calledWith({
coverageVariable: '__coverage__',
embedSource: false,
Expand Down

0 comments on commit 31f65b9

Please sign in to comment.