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
12 changes: 0 additions & 12 deletions tests/fixtures/middleware-conditions/app/layout.js

This file was deleted.

12 changes: 0 additions & 12 deletions tests/fixtures/middleware-conditions/app/test/next/page.js

This file was deleted.

16 changes: 16 additions & 0 deletions tests/fixtures/middleware-conditions/pages/test/next.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export default function Page({ message }) {
return (
<main>
<h1>Message from middleware: {message}</h1>
</main>
)
}

/** @type {import('next').GetServerSideProps} */
export const getServerSideProps = async (ctx) => {
return {
props: {
message: ctx.req.headers['x-hello-from-middleware-req'] || null,
},
}
}
3 changes: 3 additions & 0 deletions tests/integration/cache-handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
} from '../utils/helpers.js'
import {
nextVersionSatisfies,
shouldHaveAppRouterGlobalErrorInPrerenderManifest,
shouldHaveAppRouterNotFoundInPrerenderManifest,
} from '../utils/next-version-helpers.mjs'

Expand Down Expand Up @@ -218,6 +219,7 @@ describe('app router', () => {
expect(blobEntries.map(({ key }) => decodeBlobKey(key)).sort()).toEqual(
[
'/404',
shouldHaveAppRouterGlobalErrorInPrerenderManifest() ? '/_global-error' : undefined,
shouldHaveAppRouterNotFoundInPrerenderManifest() ? '/_not-found' : undefined,
'/index',
'/posts/1',
Expand Down Expand Up @@ -371,6 +373,7 @@ describe('plugin', () => {
expect(blobEntries.map(({ key }) => decodeBlobKey(key)).sort()).toEqual(
[
'/404',
shouldHaveAppRouterGlobalErrorInPrerenderManifest() ? '/_global-error' : undefined,
shouldHaveAppRouterNotFoundInPrerenderManifest() ? '/_not-found' : undefined,
'/api/revalidate-handler',
'/api/static/first',
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/simple-app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
} from '../utils/helpers.js'
import {
nextVersionSatisfies,
shouldHaveAppRouterGlobalErrorInPrerenderManifest,
shouldHaveAppRouterNotFoundInPrerenderManifest,
} from '../utils/next-version-helpers.mjs'

Expand Down Expand Up @@ -394,6 +395,7 @@ test.skipIf(process.env.NEXT_VERSION !== 'canary')<FixtureTestContext>(
expect(blobEntries.map(({ key }) => decodeBlobKey(key)).sort()).toEqual(
[
'/404',
shouldHaveAppRouterGlobalErrorInPrerenderManifest() ? '/_global-error' : undefined,
shouldHaveAppRouterNotFoundInPrerenderManifest() ? '/_not-found' : undefined,
'/index',
'404.html',
Expand Down
7 changes: 7 additions & 0 deletions tests/utils/next-version-helpers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ export function shouldHaveAppRouterNotFoundInPrerenderManifest() {
return nextVersionSatisfies(isNextCanary() ? '>=15.4.2-canary.33' : '>=15.5.0')
}

export function shouldHaveAppRouterGlobalErrorInPrerenderManifest() {
// https://github.com/vercel/next.js/pull/82444

// this is not used in any stable version yet
return isNextCanary() && nextVersionSatisfies('>=15.5.1-canary.4')
}

/**
* Check if current next version requires React 19
* @param {string} version Next version
Expand Down
Loading