Unverified Commit 3767dfae authored by Janka Uryga's avatar Janka Uryga Committed by GitHub

test: fork select tests on partialPrefetching (#95279)

Stopgap until we make this a proper part of the CI matrix
parent e37c6d63
...@@ -2215,6 +2215,10 @@ function enforceExperimentalFeatures( ...@@ -2215,6 +2215,10 @@ function enforceExperimentalFeatures(
config.cacheComponents = true config.cacheComponents = true
} }
if (process.env.__NEXT_PARTIAL_PREFETCHING === 'true') {
config.partialPrefetching = true
}
// TODO: Remove this once cachedNavigations is the default. Note: // TODO: Remove this once cachedNavigations is the default. Note:
// cachedNavigations may be the string 'allow-runtime'. These guards treat it // cachedNavigations may be the string 'allow-runtime'. These guards treat it
// as truthy, so an explicit 'allow-runtime' is respected here and in the // as truthy, so an explicit 'allow-runtime' is respected here and in the
......
process.env.__NEXT_PARTIAL_PREFETCHING = 'true'
require('./cache-components-dev-errors.test')
import { nextTestSetup, Playwright } from 'e2e-utils' import { nextTestSetup, Playwright } from 'e2e-utils'
import { retry, waitFor } from 'next-test-utils' import { retry, waitFor } from 'next-test-utils'
const partialPrefetching = !!process.env.__NEXT_PARTIAL_PREFETCHING
describe('cache-components-dev-streaming', () => { describe('cache-components-dev-streaming', () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
env: {
__NEXT_PARTIAL_PREFETCHING: partialPrefetching ? 'true' : '',
},
}) })
it('should stream suspense boundaries while filling caches in the background', async () => { it('should stream suspense boundaries while filling caches in the background', async () => {
......
import type { NextConfig } from 'next' import type { NextConfig } from 'next'
const partialPrefetching = !!process.env.__NEXT_PARTIAL_PREFETCHING
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
cacheComponents: true, cacheComponents: true,
partialPrefetching,
} }
export default nextConfig export default nextConfig
process.env.__NEXT_PARTIAL_PREFETCHING = 'true'
require('./cache-components.dev-warmup.test')
process.env.__NEXT_PARTIAL_PREFETCHING = 'true'
require('./cache-components-tasks.test')
process.env.__NEXT_PARTIAL_PREFETCHING = 'true'
require('./react-performance-track.test')
process.env.__NEXT_PARTIAL_PREFETCHING = 'true'
require('./cache-components-errors.client.test')
process.env.__NEXT_PARTIAL_PREFETCHING = 'true'
require('./cache-components-errors.test')
process.env.__NEXT_PARTIAL_PREFETCHING = 'true'
require('./instant-validation-build.test')
process.env.__NEXT_PARTIAL_PREFETCHING = 'true'
require('./instant-validation-causes.test')
process.env.__NEXT_PARTIAL_PREFETCHING = 'true'
require('./instant-validation-static-shells.test')
process.env.__NEXT_PARTIAL_PREFETCHING = 'true'
require('./instant-validation.test')
process.env.__NEXT_PARTIAL_PREFETCHING = 'true'
require('./validations.console.test')
import { isNextDev, nextTestSetup } from 'e2e-utils' import { isNextDev, nextTestSetup } from 'e2e-utils'
import { waitForNoRedbox } from 'next-test-utils' import { waitForNoRedbox } from 'next-test-utils'
const partialPrefetching = !!process.env.__NEXT_PARTIAL_PREFETCHING
describe('Validations for <Link legacyBehavior>', () => { describe('Validations for <Link legacyBehavior>', () => {
const { next, skipped } = nextTestSetup({ const { next, skipped } = nextTestSetup({
files: __dirname, files: __dirname,
...@@ -58,10 +60,20 @@ describe('Validations for <Link legacyBehavior>', () => { ...@@ -58,10 +60,20 @@ describe('Validations for <Link legacyBehavior>', () => {
] ]
`) `)
} else { } else {
expect(newConsoleOutput()).toMatchInlineSnapshot(` if (partialPrefetching) {
"Using a Server Component as a direct child of \`<Link legacyBehavior>\` is not supported. If you need legacyBehavior, wrap your Server Component in a Client Component that renders the Link's \`<a>\` tag. // In Partial Prefetching, we do a second render to produce the embedded
" // runtime prefetch stream, which results in a second log.
`) expect(newConsoleOutput()).toMatchInlineSnapshot(`
"Using a Server Component as a direct child of \`<Link legacyBehavior>\` is not supported. If you need legacyBehavior, wrap your Server Component in a Client Component that renders the Link's \`<a>\` tag.
Using a Server Component as a direct child of \`<Link legacyBehavior>\` is not supported. If you need legacyBehavior, wrap your Server Component in a Client Component that renders the Link's \`<a>\` tag.
"
`)
} else {
expect(newConsoleOutput()).toMatchInlineSnapshot(`
"Using a Server Component as a direct child of \`<Link legacyBehavior>\` is not supported. If you need legacyBehavior, wrap your Server Component in a Client Component that renders the Link's \`<a>\` tag.
"
`)
}
} }
}) })
......
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