diff --git a/test/e2e/app-dir/app-invalid-revalidate/app-invalid-revalidate.test.ts b/test/e2e/app-dir/app-invalid-revalidate/app-invalid-revalidate.test.ts index 398eaa6261de8..1908b8ce41c59 100644 --- a/test/e2e/app-dir/app-invalid-revalidate/app-invalid-revalidate.test.ts +++ b/test/e2e/app-dir/app-invalid-revalidate/app-invalid-revalidate.test.ts @@ -74,5 +74,27 @@ createNextDescribe( await next.patchFile('app/page.tsx', origText) } }) + + it('should error properly for invalid revalidate on unstable_cache', async () => { + await next.stop().catch(() => {}) + const origText = await next.readFile('app/page.tsx') + + try { + await next.patchFile( + 'app/page.tsx', + origText.replace('// await unstable', 'await unstable') + ) + await next.start().catch(() => {}) + + await check(async () => { + if (isNextDev) { + await next.fetch('/') + } + return next.cliOutput + }, /Invalid revalidate value "1" on "unstable_cache/) + } finally { + await next.patchFile('app/page.tsx', origText) + } + }) } ) diff --git a/test/e2e/app-dir/app-invalid-revalidate/app/page.tsx b/test/e2e/app-dir/app-invalid-revalidate/app/page.tsx index 0a55367c3f55d..02b0c157e1112 100644 --- a/test/e2e/app-dir/app-invalid-revalidate/app/page.tsx +++ b/test/e2e/app-dir/app-invalid-revalidate/app/page.tsx @@ -1,6 +1,9 @@ +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import { unstable_cache } from 'next/cache' // export const revalidate = '1' export default async function Page() { // await fetch('https://example.vercel.sh', { next: { revalidate: '1' } }) + // await unstable_cache(async () => Date.now(), [], { revalidate: '1' })() return
hello world
}