Skip to content

Commit c175c24

Browse files
authored
Print Redbox content if assertNoRedbox fails (#67973)
1 parent bfbd971 commit c175c24

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/lib/next-test-utils.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,18 @@ export async function assertNoRedbox(browser: BrowserInterface) {
854854
})
855855

856856
if (hasRedbox) {
857-
const error = new Error('Expected no Redbox but found one')
857+
const [redboxHeader, redboxDescription, redboxSource] = await Promise.all([
858+
getRedboxHeader(browser).catch(() => '<missing>'),
859+
getRedboxDescription(browser).catch(() => '<missing>'),
860+
getRedboxSource(browser).catch(() => '<missing>'),
861+
])
862+
863+
const error = new Error(
864+
'Expected no Redbox but found one\n' +
865+
`header: ${redboxHeader}\n` +
866+
`description: ${redboxDescription}\n` +
867+
`source: ${redboxSource}`
868+
)
858869
Error.captureStackTrace(error, assertHasRedbox)
859870
throw error
860871
}

0 commit comments

Comments
 (0)