mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
Throw it during bundling, as opposed to at runtime. This circumnavigates a panic in Turbopack when inlining a 40mb string into a JS module.
24 lines
857 B
TypeScript
24 lines
857 B
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
import { generatePNG } from '../generate-image'
|
|
|
|
describe('app-dir - metadata-img-too-large opengraph-image', () => {
|
|
const { next, isTurbopack } = nextTestSetup({
|
|
files: __dirname,
|
|
skipStart: true,
|
|
})
|
|
|
|
const pngFile = generatePNG(8)
|
|
|
|
it('should throw when opengraph-image file size exceeds 8MB', async () => {
|
|
await next.patchFile('app/opengraph-image.png', pngFile as any)
|
|
await next.build()
|
|
|
|
const regex = isTurbopack
|
|
? // in Turbopack, the path is simplified as [project]/.... It's also thrown earlier, so the prefix is slightly different.
|
|
/File size for Open Graph image "\[project\]\/app\/opengraph-image\.png" exceeds 8MB/
|
|
: /Error: File size for Open Graph image ".*\/app\/opengraph-image\.png" exceeds 8MB/
|
|
|
|
expect(next.cliOutput).toMatch(regex)
|
|
})
|
|
})
|