Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +31 to +46
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding way to run just latest and canary variants without v13 and v14 to save CI time while working on adjustments for Next@16

else
echo "matrix=[\"latest\"]" >> $GITHUB_OUTPUT
fi
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/simple-app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to have v16 fall into version range

)

expect(headers['debug-netlify-cdn-cache-control']).toBe(
Expand Down
21 changes: 18 additions & 3 deletions tests/fixtures/ppr/next.config.js
Original file line number Diff line number Diff line change
@@ -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,
},
Comment on lines +18 to +24
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

experimental.ppr hard fails now forcing to use experimental.cacheComponents

This does introduce also introduce some changes to some behaviors and ppr test was adjusted for it as well

outputFileTracingRoot: __dirname,
}

Expand Down
3 changes: 2 additions & 1 deletion tests/fixtures/ppr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
10 changes: 8 additions & 2 deletions tests/integration/simple-app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ import {
} from '../utils/helpers.js'
import {
hasDefaultTurbopackBuilds,
isExperimentalPPRHardDeprecated,
nextVersionSatisfies,
shouldHaveAppRouterGlobalErrorInPrerenderManifest,
shouldHaveAppRouterNotFoundInPrerenderManifest,
shouldHaveSlashIndexTagForIndexPage,
} from '../utils/next-version-helpers.mjs'

const mockedCp = cp as Mock<(typeof import('node:fs/promises'))['cp']>
Expand Down Expand Up @@ -205,7 +207,11 @@ test<FixtureTestContext>('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
Expand Down Expand Up @@ -398,7 +404,7 @@ test.skipIf(process.env.NEXT_VERSION !== 'canary')<FixtureTestContext>(
'/1',
'/2',
'/404',
'/[dynamic]',
isExperimentalPPRHardDeprecated() ? undefined : '/[dynamic]',
shouldHaveAppRouterGlobalErrorInPrerenderManifest() ? '/_global-error' : undefined,
shouldHaveAppRouterNotFoundInPrerenderManifest() ? '/_not-found' : undefined,
'/index',
Expand Down
10 changes: 10 additions & 0 deletions tests/utils/next-version-helpers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ 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')
}

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
Expand Down
Loading