Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit eb4734b

Browse files
authored
test: adjustments for next@canary (#3072)
1 parent bfe1504 commit eb4734b

File tree

10 files changed

+28
-24
lines changed

10 files changed

+28
-24
lines changed

‎tests/fixtures/middleware-conditions/app/layout.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

‎tests/fixtures/middleware-conditions/app/test/next/page.js

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
export default function Page({ message }) {
2+
return (
3+
<main>
4+
<h1>Message from middleware: {message}</h1>
5+
</main>
6+
)
7+
}
8+
9+
/** @type {import('next').GetServerSideProps} */
10+
export const getServerSideProps = async (ctx) => {
11+
return {
12+
props: {
13+
message: ctx.req.headers['x-hello-from-middleware-req'] || null,
14+
},
15+
}
16+
}

‎tests/integration/cache-handler.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
} from '../utils/helpers.js'
2020
import {
2121
nextVersionSatisfies,
22+
shouldHaveAppRouterGlobalErrorInPrerenderManifest,
2223
shouldHaveAppRouterNotFoundInPrerenderManifest,
2324
} from '../utils/next-version-helpers.mjs'
2425

@@ -218,6 +219,7 @@ describe('app router', () => {
218219
expect(blobEntries.map(({ key }) => decodeBlobKey(key)).sort()).toEqual(
219220
[
220221
'/404',
222+
shouldHaveAppRouterGlobalErrorInPrerenderManifest() ? '/_global-error' : undefined,
221223
shouldHaveAppRouterNotFoundInPrerenderManifest() ? '/_not-found' : undefined,
222224
'/index',
223225
'/posts/1',
@@ -371,6 +373,7 @@ describe('plugin', () => {
371373
expect(blobEntries.map(({ key }) => decodeBlobKey(key)).sort()).toEqual(
372374
[
373375
'/404',
376+
shouldHaveAppRouterGlobalErrorInPrerenderManifest() ? '/_global-error' : undefined,
374377
shouldHaveAppRouterNotFoundInPrerenderManifest() ? '/_not-found' : undefined,
375378
'/api/revalidate-handler',
376379
'/api/static/first',

‎tests/integration/simple-app.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import {
3636
} from '../utils/helpers.js'
3737
import {
3838
nextVersionSatisfies,
39+
shouldHaveAppRouterGlobalErrorInPrerenderManifest,
3940
shouldHaveAppRouterNotFoundInPrerenderManifest,
4041
} from '../utils/next-version-helpers.mjs'
4142

@@ -394,6 +395,7 @@ test.skipIf(process.env.NEXT_VERSION !== 'canary')<FixtureTestContext>(
394395
expect(blobEntries.map(({ key }) => decodeBlobKey(key)).sort()).toEqual(
395396
[
396397
'/404',
398+
shouldHaveAppRouterGlobalErrorInPrerenderManifest() ? '/_global-error' : undefined,
397399
shouldHaveAppRouterNotFoundInPrerenderManifest() ? '/_not-found' : undefined,
398400
'/index',
399401
'404.html',

‎tests/utils/next-version-helpers.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ export function shouldHaveAppRouterNotFoundInPrerenderManifest() {
3838
return nextVersionSatisfies(isNextCanary() ? '>=15.4.2-canary.33' : '>=15.5.0')
3939
}
4040

41+
export function shouldHaveAppRouterGlobalErrorInPrerenderManifest() {
42+
// https://github.com/vercel/next.js/pull/82444
43+
44+
// this is not used in any stable version yet
45+
return isNextCanary() && nextVersionSatisfies('>=15.5.1-canary.4')
46+
}
47+
4148
/**
4249
* Check if current next version requires React 19
4350
* @param {string} version Next version

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /