mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### What Display `global-error.js` along with error overlay in development. When a runtime error occurred, you should be able to view the `global-error.js` content by just hiding the error overlay. ### Why Current behavior of `global-error.js` confused a lot of users that it only renders in production build, howerver in dev it's always shows the error overlay. This was considered "expected" before as you should focus on fixing error in dev. But this brings a lot of inconvenience for users, since they can't view the `global-error.js` easily in development but production build. #### After The global-error content is displayed in the html with error overlay covered  #### Before Notice nothing displayed  Fixes #55462 Fixes #52993 Closes NDX-694
28 lines
763 B
TypeScript
28 lines
763 B
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
|
|
describe('app dir - global error - with catch-all route', () => {
|
|
const { next, skipped } = nextTestSetup({
|
|
files: __dirname,
|
|
skipDeployment: true,
|
|
})
|
|
|
|
if (skipped) {
|
|
return
|
|
}
|
|
|
|
it('should render catch-all route correctly', async () => {
|
|
expect(await next.render('/en/foo')).toContain('catch-all page')
|
|
})
|
|
|
|
it('should render 404 page correctly', async () => {
|
|
expect(await next.render('/en')).toContain('This page could not be found.')
|
|
})
|
|
|
|
it('should render global error correctly', async () => {
|
|
const browser = await next.browser('/en/error')
|
|
|
|
const text = await browser.elementByCss('#global-error').text()
|
|
expect(text).toMatchInlineSnapshot(`"global-error"`)
|
|
})
|
|
})
|