Buckets:
silverwolf-x/project / test /e2e /app-dir /app-root-params-getters /generate-static-params-error.test.ts
| import { nextTestSetup } from 'e2e-utils' | |
| import path from 'path' | |
| describe('app-root-param-getters - generateStaticParams error', () => { | |
| const { next, isNextDev } = nextTestSetup({ | |
| files: path.join(__dirname, 'fixtures', 'generate-static-params-error'), | |
| skipStart: true, | |
| skipDeployment: true, | |
| }) | |
| beforeAll(async () => { | |
| try { | |
| await next.start() | |
| } catch {} | |
| }) | |
| if (isNextDev) { | |
| it('should error when reading a root param inside the generateStaticParams that defines it - dev', async () => { | |
| const browser = await next.browser('/en/us') | |
| // TODO: This is not the correct error code. | |
| await expect(browser).toDisplayRedbox(` | |
| { | |
| "code": "E394", | |
| "description": "Route /[lang]/[locale] used \`import('next/root-params').lang()\` inside \`generateStaticParams\`, but the \`lang\` parameter was not provided by a parent \`generateStaticParams\`. In \`generateStaticParams\`, root params are only available for segments nested below the segment that provides them.", | |
| "environmentLabel": null, | |
| "label": "Runtime Error", | |
| "source": "app/[lang]/[locale]/layout.tsx (16:23) @ generateStaticParams | |
| > 16 | const l = await lang() | |
| | ^", | |
| "stack": [ | |
| "generateStaticParams app/[lang]/[locale]/layout.tsx (16:23)", | |
| ], | |
| } | |
| `) | |
| }) | |
| } else { | |
| it('should error when reading a root param inside the generateStaticParams that defines it - build', async () => { | |
| expect(next.cliOutput).toContain( | |
| "Route /[lang]/[locale] used `import('next/root-params').lang()` inside `generateStaticParams`, but the `lang` parameter was not provided by a parent `generateStaticParams`. In `generateStaticParams`, root params are only available for segments nested below the segment that provides them." | |
| ) | |
| }) | |
| } | |
| }) | |
Xet Storage Details
- Size:
- 1.9 kB
- Xet hash:
- 5235b03b6e31e1cb7c57a53b207390fb1caaa151a39b72d628a2c52d396045a9
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.