diff --git a/test/lib/next-test-utils.ts b/test/lib/next-test-utils.ts index 29c3210a11391..727b71d30bc69 100644 --- a/test/lib/next-test-utils.ts +++ b/test/lib/next-test-utils.ts @@ -854,7 +854,18 @@ export async function assertNoRedbox(browser: BrowserInterface) { }) if (hasRedbox) { - const error = new Error('Expected no Redbox but found one') + const [redboxHeader, redboxDescription, redboxSource] = await Promise.all([ + getRedboxHeader(browser).catch(() => ''), + getRedboxDescription(browser).catch(() => ''), + getRedboxSource(browser).catch(() => ''), + ]) + + const error = new Error( + 'Expected no Redbox but found one\n' + + `header: ${redboxHeader}\n` + + `description: ${redboxDescription}\n` + + `source: ${redboxSource}` + ) Error.captureStackTrace(error, assertHasRedbox) throw error }