react-code-dataset / next.js /test /development /app-dir /hook-function-names /hook-function-names.test.ts
Download next.js/test/development/app-dir/hook-function-names/hook-function-names.test.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.39 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/next.js/test/development/app-dir/hook-function-names/hook-function-names.test.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/next.js/test/development/app-dir/hook-function-names/hook-function-names.test.ts
-
curl -L -o hook-function-names.test.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/next.js/test/development/app-dir/hook-function-names/hook-function-names.test.ts
1.39 kB
| import { nextTestSetup } from 'e2e-utils' | |
| describe('hook-function-names', () => { | |
| const { next } = nextTestSetup({ | |
| files: __dirname, | |
| }) | |
| it('should show readable hook names in stacks', async () => { | |
| const browser = await next.browser('/button') | |
| await browser.elementByCss('button').click() | |
| await expect(browser).toDisplayCollapsedRedbox(` | |
| { | |
| "description": "Kaputt!", | |
| "environmentLabel": null, | |
| "label": "Runtime Error", | |
| "source": "app/button/page.tsx (7:11) @ Button.useCallback[handleClick] | |
| > 7 | throw new Error(message) | |
| | ^", | |
| "stack": [ | |
| "Button.useCallback[handleClick] app/button/page.tsx (7:11)", | |
| "button <anonymous>", | |
| "Button app/button/page.tsx (11:5)", | |
| "Page app/button/page.tsx (18:10)", | |
| ], | |
| } | |
| `) | |
| }) | |
| it('should show readable hook names in stacks for default-exported components', async () => { | |
| const browser = await next.browser('/') | |
| await expect(browser).toDisplayRedbox(` | |
| { | |
| "description": "error in useEffect", | |
| "environmentLabel": null, | |
| "label": "Runtime Error", | |
| "source": "app/page.tsx (7:11) @ Page.useEffect | |
| > 7 | throw new Error('error in useEffect') | |
| | ^", | |
| "stack": [ | |
| "Page.useEffect app/page.tsx (7:11)", | |
| ], | |
| } | |
| `) | |
| }) | |
| }) | |