diff --git a/lib/utils/audit-error.js b/lib/utils/audit-error.js index 7feccc739b6a9..aaf35566fc030 100644 --- a/lib/utils/audit-error.js +++ b/lib/utils/audit-error.js @@ -1,4 +1,5 @@ const log = require('./log-shim') +const replaceInfo = require('./replace-info.js') // print an error or just nothing if the audit report has an error // this is called by the audit command, and by the reify-output util @@ -24,7 +25,7 @@ const auditError = (npm, report) => { npm.output(JSON.stringify({ message: error.message, method: error.method, - uri: error.uri, + uri: replaceInfo(error.uri), headers: error.headers, statusCode: error.statusCode, body, diff --git a/test/lib/utils/audit-error.js b/test/lib/utils/audit-error.js index 46a9dbc38cd7d..1cb29a0857d75 100644 --- a/test/lib/utils/audit-error.js +++ b/test/lib/utils/audit-error.js @@ -87,7 +87,7 @@ t.test('error, audit command, json', async t => { message: 'message', body: { response: 'body' }, method: 'POST', - uri: 'https://example.com/not/a/registry', + uri: 'https://username:password@example.com/not/a/registry', headers: { head: ['ers'], }, @@ -101,7 +101,7 @@ t.test('error, audit command, json', async t => { '{\n' + ' "message": "message",\n' + ' "method": "POST",\n' + - ' "uri": "https://example.com/not/a/registry",\n' + + ' "uri": "https://username:***@example.com/not/a/registry",\n' + ' "headers": {\n' + ' "head": [\n' + ' "ers"\n' +