Skip to content

Commit 370b097

Browse files
authored
Turbopack Build: Fix metadata-edge test (#80842)
This test is checking if `@vercel/og` gets shared between two routes, it assumed that `next/og` itself (the wrapper code) would also be chunked, but the size limit for Turbopack is slightly larger so it doesn't end up bundling it into a separate chunk. Changed the test to check that `@vercel/og` is correctly chunked.
1 parent ad27dda commit 370b097

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

test/e2e/app-dir/metadata-edge/index.test.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,26 @@ describe('app dir - Metadata API on the Edge runtime', () => {
2222
(file) => {
2323
return next
2424
.readFileSync(path.join('.next', file))
25-
.includes('ImageResponse')
25+
.includes('experimental_FigmaImageResponse')
2626
}
2727
)
28+
expect(pageFilesThatHaveImageResponse).not.toBeEmpty()
2829

2930
const uniqueAnotherFiles = [
3031
...new Set<string>(
3132
middlewareManifest.functions['/another/page'].files
3233
),
3334
]
35+
expect(uniqueAnotherFiles).not.toBeEmpty()
3436

3537
const anotherFilesThatHaveImageResponse = uniqueAnotherFiles.filter(
3638
(file) => {
37-
return next
38-
.readFileSync(path.join('.next', file))
39-
.includes('ImageResponse')
39+
return (
40+
next
41+
.readFileSync(path.join('.next', file))
42+
// This export is not used but it checks if the `@vercel/og` package is shared between the two routes.
43+
.includes('experimental_FigmaImageResponse')
44+
)
4045
}
4146
)
4247

test/turbopack-build-tests-manifest.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3045,11 +3045,10 @@
30453045
},
30463046
"test/e2e/app-dir/metadata-edge/index.test.ts": {
30473047
"passed": [
3048-
"app dir - Metadata API on the Edge runtime should render OpenGraph image meta tag correctly"
3049-
],
3050-
"failed": [
3048+
"app dir - Metadata API on the Edge runtime should render OpenGraph image meta tag correctly",
30513049
"app dir - Metadata API on the Edge runtime OG image route should not bundle `ImageResponse` into the page worker"
30523050
],
3051+
"failed": [],
30533052
"pending": [],
30543053
"flakey": [],
30553054
"runtimeError": false

0 commit comments

Comments
 (0)