Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(smoke-tests): dont log double stdout/stderr for failing tests #7539

Closed
wants to merge 1 commit into from
Closed
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
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
Loading