Unverified Commit 9f4eccff authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

Proper e2e test of function determinism - adapter (#89522)

Closes PACK-6833

Testing
- https://github.com/nextjs/adapter-vercel/pull/18
- https://github.com/nextjs/adapter-vercel/pull/17
parent 6dece1b3
...@@ -214,7 +214,7 @@ const FILES = { ...@@ -214,7 +214,7 @@ const FILES = {
}) })
}) })
describe('build output API - builder', () => { describe.each(['builder', 'adapter'])('build output API - %s', (mode) => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
files: { files: {
// A mock file to be able to run `vercel build` without logging in // A mock file to be able to run `vercel build` without logging in
...@@ -222,7 +222,7 @@ const FILES = { ...@@ -222,7 +222,7 @@ const FILES = {
...FILES, ...FILES,
}, },
dependencies: { dependencies: {
vercel: '>=50.11.0', vercel: '>=50.12.1',
}, },
packageJson: { packageJson: {
scripts: { scripts: {
...@@ -232,27 +232,30 @@ const FILES = { ...@@ -232,27 +232,30 @@ const FILES = {
}, },
}, },
buildCommand: 'pnpm vercel build', buildCommand: 'pnpm vercel build',
env:
mode === 'adapter'
? {
NEXT_ENABLE_ADAPTER: '1',
}
: undefined,
skipStart: true, skipStart: true,
skipDeployment: true, skipDeployment: true,
}) })
it('should produce identical build outputs even when changing deployment id', async () => { it('should produce identical build outputs even when changing deployment id', async () => {
let { run1, run2 } = await runTest(next, readFilesBuilder) let { run1, run2 } = await runTest(next, readFilesBuilder)
expect([...run1.keys()]).toMatchInlineSnapshot(`
[ expect([...run1.keys()]).toIncludeAllMembers([
".vercel/output/functions/_global-error.func/.vc-config.json", '.vercel/output/functions/app-page.func/.vc-config.json',
".vercel/output/functions/_global-error.rsc.func/.vc-config.json", '.vercel/output/functions/app-page.rsc.func/.vc-config.json',
".vercel/output/functions/_not-found.func/.vc-config.json", '.vercel/output/functions/app-route.func/.vc-config.json',
".vercel/output/functions/_not-found.rsc.func/.vc-config.json", '.vercel/output/functions/app-route.rsc.func/.vc-config.json',
".vercel/output/functions/app-page.func/.vc-config.json", '.vercel/output/functions/pages-dynamic.func/.vc-config.json',
".vercel/output/functions/app-page.rsc.func/.vc-config.json", '.vercel/output/functions/pages-static-gsp.func/.vc-config.json',
".vercel/output/functions/app-route.func/.vc-config.json", ])
".vercel/output/functions/app-route.rsc.func/.vc-config.json", expect([...run1.keys()]).toSatisfyAny((k) =>
".vercel/output/functions/middleware.func/.vc-config.json", k.includes('middleware.func')
".vercel/output/functions/pages-dynamic.func/.vc-config.json", )
".vercel/output/functions/pages-static-gsp.func/.vc-config.json",
]
`)
expect([...run1.keys()]).toEqual([...run2.keys()]) expect([...run1.keys()]).toEqual([...run2.keys()])
}) })
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment