From c18c8c5875df59e701b7ed88b1ef059dbe514935 Mon Sep 17 00:00:00 2001 From: Gustav Ahlberg Date: Fri, 17 Mar 2017 13:16:32 +0100 Subject: [PATCH] Options for exec is optional (#13) Options are optional --- index.js | 3 ++- test/exec.js | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 0a24c0e..8eb5896 100644 --- a/index.js +++ b/index.js @@ -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) } diff --git a/test/exec.js b/test/exec.js index 1c1fbfc..00e1283 100644 --- a/test/exec.js +++ b/test/exec.js @@ -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) {