mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
Allows you to opt into runtime prefetching without coupling it to the way you configure instant validation. We do not intend to allow shipping runtime prefetching without opting into instant validation unless you specifically disable the validation because the cost of the runtime prefetching is potentially high but the way you configure validation is likely going to be pulling in lots of test code and we want to make it easier to discern that the validation code is not going to be bundled into production builds so separating the config is helpful. Another reason to separate the config is that we expect that eventually most prefetching is configured globally and you do not need to opt specific segments into a different prefetching strategy. Improved client component error messages to accurately describe the constraint: these are route segment configs that require a Server Component module, not exports that are forbidden.
30 lines
893 B
TypeScript
30 lines
893 B
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
import { retry } from 'next-test-utils'
|
|
|
|
describe('app dir - instant-validation-client', () => {
|
|
const { next, isNextDev, skipped } = nextTestSetup({
|
|
files: __dirname,
|
|
skipDeployment: true,
|
|
skipStart: true,
|
|
})
|
|
|
|
if (skipped) {
|
|
return
|
|
}
|
|
|
|
it('should error when a client component exports unstable_instant', async () => {
|
|
const expectedErrMsg = `"unstable_instant" is a route segment config and can only be used when the segment is a Server Component module. Remove the "use client" directive`
|
|
|
|
if (isNextDev) {
|
|
await next.start().catch(() => {})
|
|
await next.browser('/').catch(() => {})
|
|
await retry(async () => {
|
|
expect(next.cliOutput).toContain(expectedErrMsg)
|
|
})
|
|
} else {
|
|
const { cliOutput } = await next.build()
|
|
expect(cliOutput).toContain(expectedErrMsg)
|
|
}
|
|
})
|
|
})
|