From 357e6abc49077d7e4325406852d182220816e4f2 Mon Sep 17 00:00:00 2001 From: Noah Leigh Date: Sun, 3 Dec 2017 03:07:49 -0500 Subject: [PATCH] fix(index): remove extraneous logging on Windows (#136) Windows logs the path to the downloaded module, which doesn't match Unix behavior. Fixes: #131 --- index.js | 2 +- test/index.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index a1faee1..e607de6 100644 --- a/index.js +++ b/index.js @@ -351,7 +351,7 @@ function findNodeScript (existing, opts) { return str.match(cmd) || str.match(mingw) }).then(match => { return match && path.join(path.dirname(existing), match[1]) - }).then(x => console.log(x) || x) + }) } }) } diff --git a/test/index.js b/test/index.js index b48b1b9..28ad779 100644 --- a/test/index.js +++ b/test/index.js @@ -270,3 +270,14 @@ test('npx with custom installer stdio', t => { t.end() }) }) + +test('noisy npx with --quiet arg on windows', { + skip: !isWindows && 'Only on Windows does the path to the downloaded module get printed' +}, t => { + return child.spawn('node', [ + NPX_ESC, '--quiet', 'echo-cli', 'hewwo' + ], {stdio: 'pipe'}).then(res => { + t.equal(res.stdout.trim(), 'hewwo') + t.end() + }) +})