File size: 1,499 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 |
import { nextTestSetup } from 'e2e-utils'
describe('serialize-circular-error', () => {
const { next } = nextTestSetup({
files: __dirname,
})
it('should serialize the object from server component in console correctly', async () => {
const browser = await next.browser('/')
await expect(browser).toDisplayRedbox(`
{
"description": "An error occurred but serializing the error message failed.",
"environmentLabel": "Server",
"label": "Runtime Error",
"source": null,
"stack": [],
}
`)
const output = next.cliOutput
expect(output).toContain(
'Error: {"objA":{"other":{"a":"[Circular]"}},"objB":"[Circular]"}'
)
})
it('should serialize the object from client component in console correctly', async () => {
const browser = await next.browser('/client')
// TODO: Format arbitrary messages in Redbox
await expect(browser).toDisplayRedbox(`
{
"description": "[object Object]",
"environmentLabel": null,
"label": "Runtime Error",
"source": null,
"stack": [],
}
`)
const bodyText = await browser.elementByCss('body').text()
expect(bodyText).toContain(
'Application error: a client-side exception has occurred while loading localhost (see the browser console for more information).'
)
const output = next.cliOutput
expect(output).toContain(
'Error: {"objC":{"other":{"a":"[Circular]"}},"objD":"[Circular]"}'
)
})
})
|