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

test(integration): emits successful test output for continue on error #46008

Merged
merged 2 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
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
32 changes: 16 additions & 16 deletions run-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,26 +420,11 @@ async function main() {
}
}
}

if (!passed) {
console.error(`${test} failed to pass within ${numRetries} retries`)
children.forEach((child) => child.kill())

if (isTestJob) {
try {
const testsOutput = await fs.readFile(
`${test}${RESULTS_EXT}`,
'utf8'
)
console.log(
`--test output start--`,
testsOutput,
`--test output end--`
)
} catch (err) {
console.log(`Failed to load test output`, err)
}
}

if (!shouldContinueTestsOnError) {
cleanUpAndExit(1)
} else {
Expand All @@ -448,6 +433,21 @@ async function main() {
)
}
}

// Emit test output if test failed or if we're continuing tests on error
if ((!passed || shouldContinueTestsOnError) && isTestJob) {
try {
const testsOutput = await fs.readFile(`${test}${RESULTS_EXT}`, 'utf8')
console.log(
`--test output start--`,
testsOutput,
`--test output end--`
)
} catch (err) {
console.log(`Failed to load test output`, err)
}
}

sema.release()
dirSema.release()
})
Expand Down
14 changes: 13 additions & 1 deletion test/lib/e2e-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,19 @@ import { shouldRunTurboDevTest } from './next-test-utils'
export type { NextInstance }

// increase timeout to account for yarn install time
jest.setTimeout(240 * 1000)
// if either test runs for the --turbo or have a custom timeout, set reduced timeout instead.
// this is due to current --turbo test have a lot of tests fails with timeouts, ends up the whole
// test job exceeds the 6 hours limit.
let testTimeout = shouldRunTurboDevTest() ? (240 * 1000) / 4 : 240 * 1000
if (process.env.NEXT_E2E_TEST_TIMEOUT) {
try {
testTimeout = parseInt(process.env.NEXT_E2E_TEST_TIMEOUT, 10)
} catch (_) {
// ignore
}
}

jest.setTimeout(testTimeout)

const testsFolder = path.join(__dirname, '..')

Expand Down