Skip to content

Commit

Permalink
chore(smoke-tests): dont log double stdout/stderr for failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed May 16, 2024
1 parent ef4c975 commit e6fbfed
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions smoke-tests/test/fixtures/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ const getCleanPaths = async () => {
}

module.exports = async (t, { testdir = {}, debug, mockRegistry = true, useProxy = false } = {}) => {
const debugLog = debug || CI ? (...a) => t.comment(...a) : () => {}
const shouldLog = debug || CI
const debugLog = shouldLog ? (...a) => t.comment(...a) : () => {}
debugLog({ SMOKE_PUBLISH_TARBALL, CI })

const cleanPaths = await getCleanPaths()
Expand Down Expand Up @@ -175,7 +176,17 @@ module.exports = async (t, { testdir = {}, debug, mockRegistry = true, useProxy
p.process.stdout.on('data', (c) => log(c.toString().trim()))
p.process.stderr.on('data', (c) => log(c.toString().trim()))

const { stdout, stderr } = await p
const { stdout, stderr } = await p.catch(err => {
// If we are already streaming the output from stdout and stderr then
// throwing this error will make a lot more noise since tap will print
// the whole thing. So we only do that if we haven't logged anything.
if (shouldLog) {
delete err.stdout
delete err.stderr
}
throw err
})

log('='.repeat(40))

return { stderr, stdout }
Expand Down

0 comments on commit e6fbfed

Please sign in to comment.