diff options
Diffstat (limited to 'deps/npm/test/lib/cli.js')
-rw-r--r-- | deps/npm/test/lib/cli.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/deps/npm/test/lib/cli.js b/deps/npm/test/lib/cli.js index b85c981cd00..2c0b6c0ba72 100644 --- a/deps/npm/test/lib/cli.js +++ b/deps/npm/test/lib/cli.js @@ -104,6 +104,32 @@ t.test('calling with --versions calls npm version with no args', async t => { t.strictSame(exitHandlerCalled, []) }) +t.test('logged argv is sanitized', async t => { + const proc = processMock({ + argv: ['node', 'npm', 'testcommand', 'https://username:password@npmjs.org/test_url_with_a_password'], + }) + const { npm } = mockNpm(t) + const cli = cliMock(npm) + + npm.commands.testcommand = (args, cb) => { + cb() + } + + await cli(proc) + t.equal(proc.title, 'npm') + t.strictSame(logs, [ + 'pause', + ['verbose', 'cli', [ + 'node', + 'npm', + 'testcommand', + 'https://username:***@npmjs.org/test_url_with_a_password', + ]], + ['info', 'using', 'npm@%s', npm.version], + ['info', 'using', 'node@%s', process.version], + ]) +}) + t.test('print usage if no params provided', async t => { const proc = processMock({ argv: ['node', 'npm'], |