mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +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.
51 lines
1.7 KiB
TypeScript
51 lines
1.7 KiB
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
|
|
const isAdapterTest = process.env.NEXT_ENABLE_ADAPTER === '1'
|
|
|
|
describe('not-found-with-pages-i18n', () => {
|
|
const { next, isNextStart, isNextDeploy } = nextTestSetup({
|
|
files: __dirname,
|
|
})
|
|
|
|
if (isNextStart) {
|
|
it('should write all locales to the pages manifest', async () => {
|
|
const pagesManifest = JSON.parse(
|
|
await next.readFile('.next/server/pages-manifest.json')
|
|
)
|
|
|
|
expect(pagesManifest['/404']).toBe('pages/404.html')
|
|
expect(pagesManifest['/en/404']).toBe('pages/404.html')
|
|
expect(pagesManifest['/en-GB/404']).toBe('pages/404.html')
|
|
})
|
|
}
|
|
|
|
// When using the builder, pages router is incorrectly preferred. This is already fixed when using the adapter
|
|
const SKIP_TEST_FOR_BUILDER = isNextDeploy ? !isAdapterTest : false
|
|
|
|
if (!SKIP_TEST_FOR_BUILDER) {
|
|
it.each(['/app-dir/foo', '/foo'])(
|
|
'should prefer the app router 404 over the pages router 404 when both are present - browser %s',
|
|
async (s) => {
|
|
const browser = await next.browser(s)
|
|
expect(await browser.elementByCss('h1').text()).toBe(
|
|
'APP ROUTER - 404 PAGE'
|
|
)
|
|
|
|
await browser.loadPage(next.url)
|
|
expect(await browser.elementByCss('h1').text()).toBe(
|
|
'APP ROUTER - 404 PAGE'
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
it.each(SKIP_TEST_FOR_BUILDER ? ['/app-dir/foo'] : ['/app-dir/foo', '/foo'])(
|
|
'should prefer the app router 404 over the pages router 404 when both are present - SSR %s',
|
|
async (s) => {
|
|
const ssr = await next.fetch(s)
|
|
expect(ssr.status).toEqual(404)
|
|
expect(await ssr.text()).toContain('APP ROUTER - 404 PAGE')
|
|
}
|
|
)
|
|
})
|