Files
next.js/test/e2e/app-dir/instant-validation-client/instant-validation-client.test.ts
Josh StoryandGitHub d424aa8ec4 Stabilize unstable_instant (#94578)
This API has experimental modes for build validation but the dev
validation is going to be stable in the next release.
2026-06-09 13:50:25 -07:00

30 lines
875 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 instant', async () => {
const expectedErrMsg = `"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)
}
})
})