From ee4f2458e95231e469e928368dac8328216a403e Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Thu, 9 Oct 2025 15:56:41 +0200 Subject: [PATCH 1/5] test: adjust assertion for index page cache tags --- tests/integration/simple-app.test.ts | 7 ++++++- tests/utils/next-version-helpers.mjs | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/integration/simple-app.test.ts b/tests/integration/simple-app.test.ts index 7d865559fc..5b80329bc3 100644 --- a/tests/integration/simple-app.test.ts +++ b/tests/integration/simple-app.test.ts @@ -39,6 +39,7 @@ import { nextVersionSatisfies, shouldHaveAppRouterGlobalErrorInPrerenderManifest, shouldHaveAppRouterNotFoundInPrerenderManifest, + shouldHaveSlashIndexTagForIndexPage, } from '../utils/next-version-helpers.mjs' const mockedCp = cp as Mock<(typeof import('node:fs/promises'))['cp']> @@ -205,7 +206,11 @@ test('index should be normalized within the cacheHandler and await runPlugin(ctx) const index = await invokeFunction(ctx, { url: '/' }) expect(index.statusCode).toBe(200) - expect(index.headers?.['netlify-cache-tag']).toBe('_N_T_/layout,_N_T_/page,_N_T_/') + expect(index.headers?.['netlify-cache-tag']).toBe( + shouldHaveSlashIndexTagForIndexPage() + ? '_N_T_/layout,_N_T_/page,_N_T_/,_N_T_/index' + : '_N_T_/layout,_N_T_/page,_N_T_/', + ) }) // with 15.0.0-canary.187 and later Next.js no longer produce `stale-while-revalidate` directive diff --git a/tests/utils/next-version-helpers.mjs b/tests/utils/next-version-helpers.mjs index 5761f20ca6..1bd9f18501 100644 --- a/tests/utils/next-version-helpers.mjs +++ b/tests/utils/next-version-helpers.mjs @@ -53,6 +53,11 @@ export function hasDefaultTurbopackBuilds() { return nextVersionSatisfies('>=15.6.0-canary.40') } +export function shouldHaveSlashIndexTagForIndexPage() { + // https://github.com/vercel/next.js/pull/84586 + return nextVersionSatisfies('>=v15.6.0-canary.50') +} + /** * Check if current next version requires React 19 * @param {string} version Next version From d465b7aff2692fa21e033466a9792723d1440280 Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Thu, 9 Oct 2025 17:27:20 +0200 Subject: [PATCH 2/5] test: experimental.ppr deprecated --- tests/fixtures/ppr/next.config.js | 21 ++++++++++++++++++--- tests/fixtures/ppr/package.json | 3 ++- tests/integration/simple-app.test.ts | 3 ++- tests/utils/next-version-helpers.mjs | 5 +++++ 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/tests/fixtures/ppr/next.config.js b/tests/fixtures/ppr/next.config.js index 5f233036fc..665328ab73 100644 --- a/tests/fixtures/ppr/next.config.js +++ b/tests/fixtures/ppr/next.config.js @@ -1,12 +1,27 @@ +const { satisfies } = require('semver') + +// https://github.com/vercel/next.js/pull/84280 +const pprConfigHardDeprecated = satisfies( + require('next/package.json').version, + '>=15.6.0-canary.54', + { + includePrerelease: true, + }, +) + /** @type {import('next').NextConfig} */ const nextConfig = { output: 'standalone', eslint: { ignoreDuringBuilds: true, }, - experimental: { - ppr: true, - }, + experimental: pprConfigHardDeprecated + ? { + cacheComponents: true, + } + : { + ppr: true, + }, outputFileTracingRoot: __dirname, } diff --git a/tests/fixtures/ppr/package.json b/tests/fixtures/ppr/package.json index 7cc6aca0b6..276dd9325b 100644 --- a/tests/fixtures/ppr/package.json +++ b/tests/fixtures/ppr/package.json @@ -10,7 +10,8 @@ "dependencies": { "next": "canary", "react": "18.2.0", - "react-dom": "18.2.0" + "react-dom": "18.2.0", + "semver": "^7.7.2" }, "test": { "dependencies": { diff --git a/tests/integration/simple-app.test.ts b/tests/integration/simple-app.test.ts index 5b80329bc3..3339dbce34 100644 --- a/tests/integration/simple-app.test.ts +++ b/tests/integration/simple-app.test.ts @@ -36,6 +36,7 @@ import { } from '../utils/helpers.js' import { hasDefaultTurbopackBuilds, + isExperimentalPPRHardDeprecated, nextVersionSatisfies, shouldHaveAppRouterGlobalErrorInPrerenderManifest, shouldHaveAppRouterNotFoundInPrerenderManifest, @@ -403,7 +404,7 @@ test.skipIf(process.env.NEXT_VERSION !== 'canary')( '/1', '/2', '/404', - '/[dynamic]', + isExperimentalPPRHardDeprecated() ? undefined : '/[dynamic]', shouldHaveAppRouterGlobalErrorInPrerenderManifest() ? '/_global-error' : undefined, shouldHaveAppRouterNotFoundInPrerenderManifest() ? '/_not-found' : undefined, '/index', diff --git a/tests/utils/next-version-helpers.mjs b/tests/utils/next-version-helpers.mjs index 1bd9f18501..564afbf319 100644 --- a/tests/utils/next-version-helpers.mjs +++ b/tests/utils/next-version-helpers.mjs @@ -58,6 +58,11 @@ export function shouldHaveSlashIndexTagForIndexPage() { return nextVersionSatisfies('>=v15.6.0-canary.50') } +export function isExperimentalPPRHardDeprecated() { + // https://github.com/vercel/next.js/pull/84280 + return nextVersionSatisfies('>=15.6.0-canary.54') +} + /** * Check if current next version requires React 19 * @param {string} version Next version From e63c57173abb60e8caf8d5a1b35e91d3fa140c6d Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Fri, 10 Oct 2025 10:27:58 +0200 Subject: [PATCH 3/5] test: workaround type error for deprecated usage --- .../app/api/on-demand-revalidate/tag/route.ts | 6 +++++- .../use-cache/app/api/revalidate/[...slug]/route.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/fixtures/server-components/app/api/on-demand-revalidate/tag/route.ts b/tests/fixtures/server-components/app/api/on-demand-revalidate/tag/route.ts index ae91b90b4e..a2d9a0aba9 100644 --- a/tests/fixtures/server-components/app/api/on-demand-revalidate/tag/route.ts +++ b/tests/fixtures/server-components/app/api/on-demand-revalidate/tag/route.ts @@ -1,5 +1,9 @@ import { NextRequest, NextResponse } from 'next/server' -import { revalidateTag } from 'next/cache' +import { revalidateTag as typedRevalidateTag } from 'next/cache' + +// https://github.com/vercel/next.js/pull/83822 deprecated revalidateTag with single argument, but it still is working +// types however do not allow single param usage, so typing as any to workaround type error +const revalidateTag = typedRevalidateTag as any export async function GET(request: NextRequest) { const url = new URL(request.url) diff --git a/tests/fixtures/use-cache/app/api/revalidate/[...slug]/route.ts b/tests/fixtures/use-cache/app/api/revalidate/[...slug]/route.ts index 4900705b4b..519d5c0267 100644 --- a/tests/fixtures/use-cache/app/api/revalidate/[...slug]/route.ts +++ b/tests/fixtures/use-cache/app/api/revalidate/[...slug]/route.ts @@ -1,6 +1,10 @@ -import { revalidateTag } from 'next/cache' +import { revalidateTag as typedRevalidateTag } from 'next/cache' import { NextRequest } from 'next/server' +// https://github.com/vercel/next.js/pull/83822 deprecated revalidateTag with single argument, but it still is working +// types however do not allow single param usage, so typing as any to workaround type error +const revalidateTag = typedRevalidateTag as any + export async function GET(request: NextRequest, { params }) { const { slug } = await params From 5cedb8b42d4477df2d4f7cf2a56f777c97a57efd Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Fri, 10 Oct 2025 10:34:42 +0200 Subject: [PATCH 4/5] ci: allow testing latest and canary and not all versions to save on time --- .github/workflows/run-tests.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 719e82df1d..4d4d56c649 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -28,15 +28,22 @@ jobs: repo: context.repo.repo, issue_number: context.payload.pull_request.number, }); - return labels.some(label => label.name === 'autorelease: pending' || label.name === 'test all versions'); + const shouldTestAllVersions = labels.some(label => label.name === 'autorelease: pending' || label.name === 'test all versions'); + if (shouldTestAllVersions) { + return 'all' + } + + return labels.some(label => label.name === 'test latest and canary') ? 'latest-and-canary' : 'latest' - name: Set Next.js versions to test id: set-matrix # If this is the nightly build or a release PR then run the full matrix of versions run: | if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then echo "matrix=${{ github.event.inputs.versions }}" >> $GITHUB_OUTPUT - elif [ "${{ github.event_name }}" = "schedule" ] || [ "${{ steps.check-labels.outputs.result }}" = "true" ]; then + elif [ "${{ github.event_name }}" = "schedule" ] || [ "${{ steps.check-labels.outputs.result }}" = "all" ]; then echo "matrix=[\"latest\", \"canary\", \"14.2.15\", \"13.5.1\"]" >> $GITHUB_OUTPUT + elif [ "${{ steps.check-labels.outputs.result }}" = "latest-and-canary" ]; then + echo "matrix=[\"latest\", \"canary\"]" >> $GITHUB_OUTPUT else echo "matrix=[\"latest\"]" >> $GITHUB_OUTPUT fi From 18f7ee77c9973b6f090a811e2ecbc90f03cfeb69 Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Fri, 10 Oct 2025 11:05:45 +0200 Subject: [PATCH 5/5] test: adjust version check to also include v16 --- tests/e2e/simple-app.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/simple-app.test.ts b/tests/e2e/simple-app.test.ts index c9b4aea017..50a6773bcd 100644 --- a/tests/e2e/simple-app.test.ts +++ b/tests/e2e/simple-app.test.ts @@ -234,7 +234,7 @@ test('requesting a non existing page route that needs to be fetched from the blo // would not ... and then https://github.com/vercel/next.js/pull/69802 changed it back again // (14.2.10 and canary.147) const shouldHavePrivateDirective = nextVersionSatisfies( - '<14.2.4 || >=14.2.10 <15.0.0-canary.24 || ^15.0.0-canary.147', + '<14.2.4 || >=14.2.10 <15.0.0-canary.24 || >=15.0.0-canary.147', ) expect(headers['debug-netlify-cdn-cache-control']).toBe(