-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wraps logged process.argv in `replaceInfo` Removes logged process.argv from EJSONPARSE warning for top level package.json merge conflicts. It is currently not even working (er.file is not being populated by the parsing library right now), and process.argv contains fullly resolved paths which isn't very nice looking. The user knows what they typed, it's enough to tell them to retry. PR-URL: #3658 Credit: @wraithgar Close: #3658 Reviewed-by: @nlf
- Loading branch information
Showing
4 changed files
with
30 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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:[email protected]/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'], | ||
|