Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/utils/error-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ module.exports = (er, npm) => {
detail.push(['signal', er.signal])

if (er.cmd && Array.isArray(er.args))
detail.push(['command', ...[er.cmd, ...er.args]])
detail.push(['command', ...[er.cmd, ...er.args.map(replaceInfo)]])

if (er.stdout)
detail.push(['', er.stdout.trim()])
Expand Down
34 changes: 34 additions & 0 deletions tap-snapshots/test/lib/utils/error-message.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,40 @@ Object {
}
`

exports[`test/lib/utils/error-message.js TAP args are cleaned > must match snapshot 1`] = `
Object {
"detail": Array [
Array [
"signal",
"SIGYOLO",
],
Array [
"command",
"some command",
"a",
"r",
"g",
"s",
"https://evil:***@npmjs.org",
],
Array [
"",
"stdout",
],
Array [
"",
"stderr",
],
],
"summary": Array [
Array [
"",
"cmd err",
],
],
}
`

exports[`test/lib/utils/error-message.js TAP bad engine with config loaded > must match snapshot 1`] = `
Object {
"detail": Array [
Expand Down
11 changes: 11 additions & 0 deletions test/lib/utils/error-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,17 @@ t.test('default message', t => {
t.end()
})

t.test('args are cleaned', t => {
t.matchSnapshot(errorMessage(Object.assign(new Error('cmd err'), {
cmd: 'some command',
signal: 'SIGYOLO',
args: ['a', 'r', 'g', 's', 'https://evil:[email protected]'],
stdout: 'stdout',
stderr: 'stderr',
}), npm))
t.end()
})

t.test('eacces/eperm', t => {
const runTest = (windows, loaded, cachePath, cacheDest) => t => {
if (windows)
Expand Down