Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 24 additions & 36 deletions test/production/deterministic-build/deployment-id.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,9 @@ async function runTest(
})

describe.each([
{ test: 'standard', mode: 'builder' } as const,
{ test: 'standard', mode: 'adapter' } as const,
{ test: 'cacheComponents', mode: 'builder' } as const,
{ test: 'cacheComponents', mode: 'adapter' } as const,
])('build output API - $test $mode', ({ test, mode }) => {
{ test: 'standard' } as const,
{ test: 'cacheComponents' } as const,
])('build output API - $test adapter', ({ test }) => {
const { next } = nextTestSetup({
files: {
// A mock file to be able to run `vercel build` without logging in
Expand All @@ -243,43 +241,33 @@ async function runTest(
// We use NEXT_TEST_PREFER_OFFLINE, so just declaring `vercel: latest` as a dependency still
// doesn't force the latest version.
buildCommand: 'pnpm dlx vercel@latest build',
env:
mode === 'adapter'
? {
NEXT_ENABLE_ADAPTER: '1',
}
: undefined,
env: {
NEXT_ENABLE_ADAPTER: '1',
},
skipStart: true,
disableAutoSkewProtection: true,
})

it(
'should produce identical build outputs even when changing deployment id',
async () => {
let { run1, run2 } = await runTest(next, readFilesBuilder)
it('should produce identical build outputs even when changing deployment id', async () => {
let { run1, run2 } = await runTest(next, readFilesBuilder)

expect(run1.size).toBeGreaterThan(0)
expect([...run1.keys()]).toEqual([...run2.keys()])
expect(run1.size).toBeGreaterThan(0)
expect([...run1.keys()]).toEqual([...run2.keys()])

if (test === 'standard') {
expect([...run1.keys()]).toIncludeAllMembers([
'.vercel/output/functions/app-page.func/.vc-config.json',
'.vercel/output/functions/app-page.rsc.func/.vc-config.json',
'.vercel/output/functions/app-route.func/.vc-config.json',
'.vercel/output/functions/app-route.rsc.func/.vc-config.json',
'.vercel/output/functions/pages-dynamic.func/.vc-config.json',
'.vercel/output/functions/pages-static-gsp.func/.vc-config.json',
])
expect([...run1.keys()]).toSatisfyAny((k) =>
k.includes('middleware.func')
)
}
},
// The builder mode can take a bit longer, so we increase the timeout
// for these tests. The adapter mode should be faster, so we leave it as
// the default.
mode === 'builder' ? 120_000 : undefined
)
if (test === 'standard') {
expect([...run1.keys()]).toIncludeAllMembers([
'.vercel/output/functions/app-page.func/.vc-config.json',
'.vercel/output/functions/app-page.rsc.func/.vc-config.json',
'.vercel/output/functions/app-route.func/.vc-config.json',
'.vercel/output/functions/app-route.rsc.func/.vc-config.json',
'.vercel/output/functions/pages-dynamic.func/.vc-config.json',
'.vercel/output/functions/pages-static-gsp.func/.vc-config.json',
])
expect([...run1.keys()]).toSatisfyAny((k) =>
k.includes('middleware.func')
)
}
})
})
}
)
Loading