Commit 3f5f6a9c authored by Sam Selikoff's avatar Sam Selikoff

wip

parent 3ae9d4c8
...@@ -2,14 +2,16 @@ import { nextTestSetup } from 'e2e-utils' ...@@ -2,14 +2,16 @@ import { nextTestSetup } from 'e2e-utils'
import type * as Playwright from 'playwright' import type * as Playwright from 'playwright'
import { createRouterAct } from 'router-act' import { createRouterAct } from 'router-act'
import { retry } from 'next-test-utils' import { retry } from 'next-test-utils'
;(process.env.__NEXT_CACHE_COMPONENTS ? describe.skip : describe)( import { outdent } from 'outdent'
'segment cache - export const unstable_staleTime',
() => { const isCacheComponentsEnabled = process.env.__NEXT_CACHE_COMPONENTS === 'true'
describe('segment cache - export const unstable_staleTime', () => {
const { next, isNextDev } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: __dirname,
}) })
if (isNextDev) { if (isNextDev || isCacheComponentsEnabled) {
test('skipped in development', () => {}) test('skipped in development', () => {})
return return
} }
...@@ -82,8 +84,7 @@ import { retry } from 'next-test-utils' ...@@ -82,8 +84,7 @@ import { retry } from 'next-test-utils'
// segment cache during navigation, which is a more significant change. // segment cache during navigation, which is a more significant change.
// //
// The unstable_staleTime segment config works correctly for prefetched routes. // The unstable_staleTime segment config works correctly for prefetched routes.
} })
)
describe('unstable_staleTime - layout build error', () => { describe('unstable_staleTime - layout build error', () => {
const { next, isNextDev, skipped } = nextTestSetup({ const { next, isNextDev, skipped } = nextTestSetup({
...@@ -99,20 +100,21 @@ describe('unstable_staleTime - layout build error', () => { ...@@ -99,20 +100,21 @@ describe('unstable_staleTime - layout build error', () => {
it('should error when unstable_staleTime is used in a layout', async () => { it('should error when unstable_staleTime is used in a layout', async () => {
await next.patchFile( await next.patchFile(
'app/layout.tsx', 'app/layout.tsx',
`export const unstable_staleTime = 60 outdent`
export const unstable_staleTime = 60
export default function RootLayout({ export default function RootLayout({
children, children,
}: { }: {
children: React.ReactNode children: React.ReactNode
}) { }) {
return ( return (
<html lang="en"> <html lang="en">
<body>{children}</body> <body>{children}</body>
</html> </html>
) )
} }
`, `,
async () => { async () => {
try { try {
await next.start() await next.start()
...@@ -149,10 +151,11 @@ describe('unstable_staleTime - cacheComponents build error', () => { ...@@ -149,10 +151,11 @@ describe('unstable_staleTime - cacheComponents build error', () => {
it('should error when unstable_staleTime is used with cacheComponents', async () => { it('should error when unstable_staleTime is used with cacheComponents', async () => {
await next.patchFile( await next.patchFile(
'next.config.js', 'next.config.js',
`module.exports = { outdent`
module.exports = {
cacheComponents: true, cacheComponents: true,
} }
`, `,
async () => { async () => {
try { try {
await next.start() await next.start()
......
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