Skip to content

Commit

Permalink
Options for exec is optional (#13)
Browse files Browse the repository at this point in the history
Options are optional
  • Loading branch information
Gyran authored and timoxley committed Mar 17, 2017
1 parent 7a5127b commit c18c8c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Expand Up @@ -22,9 +22,10 @@ npmExec.execSync = npmExecSync
module.exports = npmExec

function npmExec (command, options, fn) {
var a = normalizeExecArgs(command, options)
var a = normalizeExecArgs(command, options, fn)
command = a[0]
options = a[1]
fn = a[2]
return exec(command, augmentOptionsSync(options), fn)
}

Expand Down
10 changes: 10 additions & 0 deletions test/exec.js
Expand Up @@ -30,6 +30,16 @@ test('passing args', function (t) {
})
})

test('options are optional', function (t) {
var badPath = 'not-exist-adsjk'

npmRun(badPath, function (err, stdout, stderr) {
t.ok(err, 'has error')
t.equal(err.code, 127)
t.end()
})
})

test('includes all .bin dirs in all parent node_modules folders', function (t) {
t.test('no nesting', function (t) {
npmRun('level1', {cwd: level[0]}, function (err, stdout, stderr) {
Expand Down

0 comments on commit c18c8c5

Please sign in to comment.