Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
93eaf146
Unverified
Commit
93eaf146
authored
May 28, 2026
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
May 28, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] Add test for static metadata files and `generateStaticParams` (#93465)
parent
4797acb8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
22 deletions
+44
-22
layout.tsx
test/e2e/app-dir/metadata-static-file-gsp/app/layout.tsx
+11
-0
opengraph-image.png
...data-static-file-gsp/app/results/[id]/opengraph-image.png
+0
-0
page.tsx
...pp-dir/metadata-static-file-gsp/app/results/[id]/page.tsx
+12
-0
metadata-static-file-gsp.test.ts
...metadata-static-file-gsp/metadata-static-file-gsp.test.ts
+15
-0
next.config.js
test/e2e/app-dir/metadata-static-file-gsp/next.config.js
+6
-0
metadata-static-file-dynamic-route.test.ts
...ta-static-file/metadata-static-file-dynamic-route.test.ts
+0
-22
No files found.
test/e2e/app-dir/metadata-static-file-gsp/app/layout.tsx
0 → 100644
View file @
93eaf146
export
default
function
RootLayout
({
children
,
}:
{
children
:
React
.
ReactNode
})
{
return
(
<
html
lang=
"en"
>
<
body
>
{
children
}
</
body
>
</
html
>
)
}
test/e2e/app-dir/metadata-static-file-gsp/app/results/[id]/opengraph-image.png
0 → 100644
View file @
93eaf146
67 Bytes
test/e2e/app-dir/metadata-static-file-gsp/app/results/[id]/page.tsx
0 → 100644
View file @
93eaf146
export
function
generateStaticParams
()
{
return
[{
id
:
'one'
},
{
id
:
'two'
}]
}
export
default
async
function
Page
({
params
,
}:
{
params
:
Promise
<
{
id
:
string
}
>
})
{
const
{
id
}
=
await
params
return
<
p
>
result:
{
id
}
</
p
>
}
test/e2e/app-dir/metadata-static-file-gsp/metadata-static-file-gsp.test.ts
0 → 100644
View file @
93eaf146
import
{
nextTestSetup
}
from
'e2e-utils'
describe
(
'metadata-static-file-gsp'
,
()
=>
{
const
{
next
,
skipped
}
=
nextTestSetup
({
files
:
__dirname
,
})
if
(
skipped
)
{
return
}
it
(
'should build and serve a static metadata file colocated with generateStaticParams'
,
async
()
=>
{
await
next
.
render
(
'/results/two'
)
})
})
test/e2e/app-dir/metadata-static-file-gsp/next.config.js
0 → 100644
View file @
93eaf146
/**
* @type {import('next').NextConfig}
*/
const
nextConfig
=
{}
module
.
exports
=
nextConfig
test/e2e/app-dir/metadata-static-file/metadata-static-file-dynamic-route.test.ts
View file @
93eaf146
...
@@ -6,28 +6,6 @@ import {
...
@@ -6,28 +6,6 @@ import {
}
from
'./utils'
}
from
'./utils'
describe
(
'metadata-files-static-output-dynamic-route'
,
()
=>
{
describe
(
'metadata-files-static-output-dynamic-route'
,
()
=>
{
if
(
process
.
env
.
__NEXT_CACHE_COMPONENTS
)
{
// Cache Components build fails when metadata files are inside a dynamic route.
//
// Route "/dynamic/[id]": Next.js encountered uncached or runtime data in `generateMetadata()`.
//
// This prevents the page from being prerendered, leading to a slower user experience.
//
// Ways to fix this:
// - Use a static metadata export instead of `generateMetadata()`
// - Cache the metadata with `"use cache"` in `generateMetadata()`
// - Add a dynamic data access (e.g. `await connection()`) to the page to render it at request time
// - Set `export const instant = false` to allow a blocking route
//
// Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata
// Error occurred prerendering page "/dynamic/[id]". Read more: https://nextjs.org/docs/messages/prerender-error
// Export encountered an error on /dynamic/[id]/page: /dynamic/[id], exiting the build.
//
// TODO: Remove this skip when metadata files are supported in dynamic routes for Cache Components.
it
.
skip
(
'should skip test for Cache Components'
,
()
=>
{})
return
}
const
{
next
,
skipped
}
=
nextTestSetup
({
const
{
next
,
skipped
}
=
nextTestSetup
({
files
:
__dirname
,
files
:
__dirname
,
})
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment