File size: 1,537 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
import { nextTestSetup } from 'e2e-utils'
import { assertNoRedbox, hasErrorToast } from 'next-test-utils'
describe('ssr-only-error', () => {
const { next } = nextTestSetup({
files: __dirname,
})
it('should show ssr only error in error overlay', async () => {
const browser = await next.browser('/')
// TODO(veil): Missing Owner Stack (NDX-905)
await expect(browser).toDisplayCollapsedRedbox(`
{
"description": "SSR only error",
"environmentLabel": null,
"label": "Runtime Error",
"source": "app/page.tsx (5:11) @ Component
> 5 | throw new Error('SSR only error')
| ^",
"stack": [
"Component app/page.tsx (5:11)",
],
}
`)
})
it('should not handle internal nextjs errors that will be handled by error boundaries', async () => {
const browser = await next.browser('/notfound', {
pushErrorAsConsoleLog: true,
})
await assertNoRedbox(browser)
expect(await hasErrorToast(browser)).toBe(false)
const text = await browser.elementByCss('body').text()
expect(text).toBe('404\nThis page could not be found.')
// Assert there's only one console.error from browser itself
const errorLogs = (await browser.log()).filter(
(log) => log.source === 'error'
)
expect(errorLogs).toEqual([
expect.objectContaining({
source: 'error',
message: expect.stringContaining(
'the server responded with a status of 404'
),
}),
])
})
})
|