Download next.js/test/development/app-dir/ssr-only-error/ssr-only-error.test.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.54 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/development/app-dir/ssr-only-error/ssr-only-error.test.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/development/app-dir/ssr-only-error/ssr-only-error.test.ts
-
curl -L -o ssr-only-error.test.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/development/app-dir/ssr-only-error/ssr-only-error.test.ts
1.54 kB
| 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' | |
| ), | |
| }), | |
| ]) | |
| }) | |
| }) | |