diff --git a/lib/utils/exit-handler.js b/lib/utils/exit-handler.js index a18a78da849a0..7be138d2c361f 100644 --- a/lib/utils/exit-handler.js +++ b/lib/utils/exit-handler.js @@ -65,9 +65,8 @@ process.on('exit', code => { writeLogFile() } // In timing mode we always write the log file - if (npm.config.loaded && npm.config.get('timing') && !wroteLogFile) { + if (npm.config.loaded && npm.config.get('timing') && !wroteLogFile) writeLogFile() - } if (wroteLogFile) { // just a line break if (npm.log.levels[npm.log.level] <= npm.log.levels.error) @@ -124,9 +123,6 @@ const exitHandler = (err) => { } else if (!(err instanceof Error)) { noLog = true npm.log.error('weird error', err) - } else if (err.code === 'EUSAGE') { - npm.output(err.message) - noLog = true } else { if (!err.code) { const matchErrorCode = err.message.match(/^(?:Error: )?(E[A-Z]+)/) diff --git a/test/lib/utils/exit-handler.js b/test/lib/utils/exit-handler.js index 40476c0d2073f..f74938750237e 100644 --- a/test/lib/utils/exit-handler.js +++ b/test/lib/utils/exit-handler.js @@ -26,7 +26,7 @@ const cacheFolder = t.testdir({}) const logFile = path.resolve(cacheFolder, '_logs', 'expecteddate-debug.log') const timingFile = path.resolve(cacheFolder, '_timing.json') -const { Npm, outputs } = mockNpm(t, { +const { Npm } = mockNpm(t, { '../../package.json': { version: '1.0.0', }, @@ -203,21 +203,6 @@ t.test('throw a non-error obj', (t) => { ) }) -t.test('EUSAGE', (t) => { - t.plan(2) - - process.once('exit', code => { - t.equal(code, 1, 'exits with exitCode 1') - }) - exitHandler(Object.assign( - new Error('this is the usage message'), - { - code: 'EUSAGE' - } - )) - t.match(outputs, [['this is the usage message']]) -}) - t.test('throw a string error', (t) => { t.plan(2) const error = 'foo bar'