Skip to content

Commit

Permalink
test(integration): emit console error when test fails
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Mar 21, 2022
1 parent cd47984 commit 7a18bdc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/integration/production/test/index.test.js
Expand Up @@ -26,6 +26,7 @@ import dynamicImportTests from './dynamic'
import processEnv from './process-env'
import security from './security'
import { promisify } from 'util'
import { error } from 'console'

const glob = promisify(globOriginal)

Expand Down Expand Up @@ -53,10 +54,14 @@ describe('Production Usage', () => {
context.appPort = appPort
app = await nextStart(appDir, appPort, { cwd: appDir })
output = (result.stderr || '') + (result.stdout || '')
console.log(output)

if (result.code !== 0) {
error(output)
throw new Error(`Failed to build, exited with code ${result.code}`)
} else {
// Note: jest captures calls to console and only emits when there's assertion fails,
// so this won't log anything for normal test execution path.
console.log(output)
}
})
afterAll(async () => {
Expand Down

0 comments on commit 7a18bdc

Please sign in to comment.