Skip to content

Commit 829503b

Browse files
committed
fix: don't break up log message across lines
1 parent 1435fcf commit 829503b

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

lib/utils/exit-handler.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ const log = require('./log-shim.js')
55
const errorMessage = require('./error-message.js')
66
const replaceInfo = require('./replace-info.js')
77

8-
const indent = (val) => Array.isArray(val) ? val.map(v => indent(v)) : ` ${val}`
9-
108
let npm = null // set by the cli
119
let exitHandlerCalled = false
1210
let showLogFileError = false
@@ -73,15 +71,15 @@ process.on('exit', code => {
7371
const message = []
7472

7573
if (timingFile) {
76-
message.push('Timing info written to:', indent(timingFile))
74+
message.push(`Timing info written to: ${timingFile}`)
7775
} else if (timing) {
7876
message.push(
7977
`The timing file was not written due to an error writing to the directory: ${timingDir}`
8078
)
8179
}
8280

8381
if (logFiles.length) {
84-
message.push('A complete log of this run can be found in:', ...indent(logFiles))
82+
message.push(`A complete log of this run can be found in: ${logFiles}`)
8583
} else if (logsMax <= 0) {
8684
// user specified no log file
8785
message.push(`Log files were not written due to the config logs-max=${logsMax}`)

smoke-tests/tap-snapshots/test/index.js.test.cjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
6868
npm ERR!
6969
npm ERR! Run "npm help ci" for more info
7070
71-
npm ERR! A complete log of this run can be found in:
72-
71+
npm ERR! A complete log of this run can be found in: {NPM}/{TESTDIR}/cache/_logs/{LOG}
7372
`
7473

7574
exports[`test/index.js TAP basic npm diff > should have expected diff output 1`] = `

smoke-tests/test/fixtures/setup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ module.exports = async (t, { testdir = {}, debug } = {}) => {
124124
.replace(/\r\n/g, '\n')
125125
.replace(/ \(in a browser\)/g, '')
126126
.replace(/^npm@.* /gm, 'npm ')
127-
.replace(/^.*debug-[0-9]+.log$/gm, '')
127+
.replace(/[0-9TZ_-]*debug-[0-9]+.log$/gm, '{LOG}')
128128
.replace(/in \d+[ms]+$/gm, 'in {TIME}')
129129
}
130130
const log = (...a) => debugLog(cleanOutput(a.join(' ')))

tap-snapshots/test/lib/utils/exit-handler.js.test.cjs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ XX error ERR DETAIL Unknown error
3232
XX verbose exit 1
3333
XX timing npm Completed in {TIME}ms
3434
XX verbose code 1
35-
XX error A complete log of this run can be found in:
36-
XX error {CWD}/cache/_logs/{DATE}-debug-0.log
35+
XX error A complete log of this run can be found in: {CWD}/cache/_logs/{DATE}-debug-0.log
3736
`
3837

3938
exports[`test/lib/utils/exit-handler.js TAP handles unknown error with logs and debug file > logs 1`] = `
@@ -63,6 +62,5 @@ error ERR DETAIL Unknown error
6362
verbose exit 1
6463
timing npm Completed in {TIME}ms
6564
verbose code 1
66-
error A complete log of this run can be found in:
67-
{CWD}/cache/_logs/{DATE}-debug-0.log
65+
error A complete log of this run can be found in: {CWD}/cache/_logs/{DATE}-debug-0.log
6866
`

0 commit comments

Comments
 (0)