-
Notifications
You must be signed in to change notification settings - Fork 27.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added error when there's missing root params
- Loading branch information
Showing
20 changed files
with
241 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
test/e2e/app-dir/ppr-missing-root-params/fixtures/multiple/app/[lang]/[region]/layout.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default function Root({ children }) { | ||
return ( | ||
<html> | ||
<body>{children}</body> | ||
</html> | ||
) | ||
} |
3 changes: 3 additions & 0 deletions
3
test/e2e/app-dir/ppr-missing-root-params/fixtures/multiple/app/[lang]/[region]/page.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Page() { | ||
return <p>hello world</p> | ||
} |
11 changes: 11 additions & 0 deletions
11
test/e2e/app-dir/ppr-missing-root-params/fixtures/multiple/next.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* @type {import('next').NextConfig} | ||
*/ | ||
const nextConfig = { | ||
experimental: { | ||
ppr: true, | ||
dynamicIO: true, | ||
}, | ||
} | ||
|
||
module.exports = nextConfig |
7 changes: 7 additions & 0 deletions
7
test/e2e/app-dir/ppr-missing-root-params/fixtures/nested/app/[lang]/blog/[slug]/page.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default function Page() { | ||
return <p>hello world</p> | ||
} | ||
|
||
export async function generateStaticParams() { | ||
return [{ slug: 'hello-world' }] | ||
} |
7 changes: 7 additions & 0 deletions
7
test/e2e/app-dir/ppr-missing-root-params/fixtures/nested/app/[lang]/layout.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default function Root({ children }) { | ||
return ( | ||
<html> | ||
<body>{children}</body> | ||
</html> | ||
) | ||
} |
11 changes: 11 additions & 0 deletions
11
test/e2e/app-dir/ppr-missing-root-params/fixtures/nested/next.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* @type {import('next').NextConfig} | ||
*/ | ||
const nextConfig = { | ||
experimental: { | ||
ppr: true, | ||
dynamicIO: true, | ||
}, | ||
} | ||
|
||
module.exports = nextConfig |
7 changes: 7 additions & 0 deletions
7
test/e2e/app-dir/ppr-missing-root-params/fixtures/single/app/[lang]/layout.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default function Root({ children }) { | ||
return ( | ||
<html> | ||
<body>{children}</body> | ||
</html> | ||
) | ||
} |
3 changes: 3 additions & 0 deletions
3
test/e2e/app-dir/ppr-missing-root-params/fixtures/single/app/[lang]/page.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Page() { | ||
return <p>hello world</p> | ||
} |
11 changes: 11 additions & 0 deletions
11
test/e2e/app-dir/ppr-missing-root-params/fixtures/single/next.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* @type {import('next').NextConfig} | ||
*/ | ||
const nextConfig = { | ||
experimental: { | ||
ppr: true, | ||
dynamicIO: true, | ||
}, | ||
} | ||
|
||
module.exports = nextConfig |
74 changes: 74 additions & 0 deletions
74
test/e2e/app-dir/ppr-missing-root-params/ppr-missing-root-params.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
import path from 'path' | ||
|
||
describe('ppr-missing-root-params (single)', () => { | ||
const { next, isNextDev } = nextTestSetup({ | ||
files: path.join(__dirname, 'fixtures/single'), | ||
skipStart: true, | ||
skipDeployment: true, | ||
}) | ||
|
||
beforeAll(async () => { | ||
try { | ||
await next.start() | ||
} catch {} | ||
}) | ||
|
||
it('should result in a build error', async () => { | ||
if (isNextDev) { | ||
await next.fetch('/en') | ||
} | ||
|
||
expect(next.cliOutput).toContain( | ||
`Error: A required root parameter (lang) was not provided in generateStaticParams for /[lang], please provide at least one value.` | ||
) | ||
}) | ||
}) | ||
|
||
describe('ppr-missing-root-params (multiple)', () => { | ||
const { next, isNextDev } = nextTestSetup({ | ||
files: path.join(__dirname, 'fixtures/multiple'), | ||
skipStart: true, | ||
skipDeployment: true, | ||
}) | ||
|
||
beforeAll(async () => { | ||
try { | ||
await next.start() | ||
} catch {} | ||
}) | ||
|
||
it('should result in a build error', async () => { | ||
if (isNextDev) { | ||
await next.fetch('/en/us') | ||
} | ||
|
||
expect(next.cliOutput).toContain( | ||
`Error: Required root params (lang, region) were not provided in generateStaticParams for /[lang]/[region], please provide at least one value for each.` | ||
) | ||
}) | ||
}) | ||
|
||
describe('ppr-missing-root-params (nested)', () => { | ||
const { next, isNextDev } = nextTestSetup({ | ||
files: path.join(__dirname, 'fixtures/nested'), | ||
skipStart: true, | ||
skipDeployment: true, | ||
}) | ||
|
||
beforeAll(async () => { | ||
try { | ||
await next.start() | ||
} catch {} | ||
}) | ||
|
||
it('should result in a build error', async () => { | ||
if (isNextDev) { | ||
await next.fetch('/en/blog/hello') | ||
} | ||
|
||
expect(next.cliOutput).toContain( | ||
`Error: A required root parameter (lang) was not provided in generateStaticParams for /[lang]/blog/[slug], please provide at least one value.` | ||
) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters