mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
https://github.com/vercel/next.js/pull/95550 wasn't enough: - https://github.com/vercel/next.js/actions/runs/28907225463/job/85769093204 - https://github.com/vercel/next.js/actions/runs/28907225463/job/85769093252 Because `VERCEL_IMMUTABLE_STATIC_FILES_ENABLED` might be set, but it still only works when using adapters, so it broke in the non-adapter deploy test jobs. Also prepare for when we switch the default of `NEXT_ENABLE_ADAPTER` by setting it explicitly to `0` for when we want to test the old CLI builder.
88 lines
2.2 KiB
TypeScript
88 lines
2.2 KiB
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
import * as cheerio from 'cheerio'
|
|
|
|
const isAdapterTest = process.env.NEXT_ENABLE_ADAPTER === '1'
|
|
|
|
describe('sub-shell-generation', () => {
|
|
const { next, isNextDev, isNextDeploy } = nextTestSetup({
|
|
files: __dirname,
|
|
// The latest changes to support this behavior on deployed infra are available in the adapter,
|
|
// and are not being backported to the CLI
|
|
skipDeployment: !isAdapterTest,
|
|
})
|
|
|
|
if (isNextDev) {
|
|
it.skip('skipping dev test', () => {})
|
|
return
|
|
}
|
|
|
|
describe('should serve the correct shell', () => {
|
|
describe.each([
|
|
[
|
|
'/[lang]/[slug]',
|
|
{
|
|
page: 'Page: (runtime)',
|
|
langLayout: 'Lang Layout: (runtime)',
|
|
rootLayout: 'Root Layout: (buildtime)',
|
|
},
|
|
['/es/1', '/es/2'],
|
|
true,
|
|
],
|
|
[
|
|
'/en/[slug]',
|
|
{
|
|
page: 'Page: (runtime)',
|
|
langLayout: 'Lang Layout: (buildtime)',
|
|
rootLayout: 'Root Layout: (buildtime)',
|
|
},
|
|
['/en/1', '/en/2'],
|
|
true,
|
|
],
|
|
[
|
|
'/fr/[slug]',
|
|
{
|
|
page: 'Page: (runtime)',
|
|
langLayout: 'Lang Layout: (buildtime)',
|
|
rootLayout: 'Root Layout: (buildtime)',
|
|
},
|
|
['/fr/2', '/fr/3'],
|
|
true,
|
|
],
|
|
[
|
|
'/fr/1',
|
|
{
|
|
page: 'Page: (buildtime)',
|
|
langLayout: 'Lang Layout: (buildtime)',
|
|
rootLayout: 'Root Layout: (buildtime)',
|
|
},
|
|
['/fr/1'],
|
|
false,
|
|
],
|
|
])('%s', (shell, { page, langLayout, rootLayout }, paths, isPostponed) => {
|
|
it.each(paths)('should serve the correct shell for %s', async (path) => {
|
|
const res = await next.fetch(path)
|
|
expect(res.status).toBe(200)
|
|
|
|
if (!isNextDeploy) {
|
|
expect(res.headers.get('x-nextjs-postponed')).toBe(
|
|
isPostponed ? '1' : null
|
|
)
|
|
}
|
|
|
|
const html = await res.text()
|
|
const $ = cheerio.load(html)
|
|
|
|
expect({
|
|
page: $('#page').text(),
|
|
langLayout: $('#lang-layout').text(),
|
|
rootLayout: $('#root-layout').text(),
|
|
}).toEqual({
|
|
page,
|
|
langLayout,
|
|
rootLayout,
|
|
})
|
|
})
|
|
})
|
|
})
|
|
})
|