Unverified Commit 0ef71084 authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

Test that overlay appears (#15850)

parent 8285df5e
...@@ -254,3 +254,29 @@ test('can fast refresh a page with config', async () => { ...@@ -254,3 +254,29 @@ test('can fast refresh a page with config', async () => {
await cleanup() await cleanup()
}) })
// https://github.com/vercel/next.js/issues/11504
test('shows an overlay for a server-side error', async () => {
const [session, cleanup] = await sandbox()
await session.patch(
'pages/index.js',
`export default function () { throw new Error('pre boom'); }`
)
const didNotReload = await session.patch(
'pages/index.js',
`export default function () { throw new Error('boom'); }`
)
expect(didNotReload).toBe(false)
expect(await session.hasRedbox(true)).toBe(true)
const source = await session.getRedboxSource()
expect(source.split(/\r?\n/g).slice(2).join('\n')).toMatchInlineSnapshot(`
"> 1 | export default function () { throw new Error('boom'); }
| ^"
`)
await cleanup()
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment