Skip to content

Commit 141d46e

Browse files
committed
debug
1 parent 8b72920 commit 141d46e

File tree

3 files changed

+143
-152
lines changed

3 files changed

+143
-152
lines changed
Lines changed: 114 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,88 @@
11
tests:
2-
- name: with-js-config-object-style
3-
config: |
4-
/** @type {import('next').NextConfig} */
5-
const nextConfig = {
6-
reactStrictMode: true,
7-
async headers() {
8-
return [
9-
{
10-
source: '/:path*',
11-
headers: [
12-
{
13-
key: 'x-custom-header',
14-
value: 'js-config-value',
15-
},
16-
{
17-
key: 'x-config-type',
18-
value: 'object',
19-
},
20-
],
21-
},
22-
];
23-
},
24-
};
2+
# - name: with-js-config-object-style
3+
# config: |
4+
# /** @type {import('next').NextConfig} */
5+
# const nextConfig = {
6+
# reactStrictMode: true,
7+
# async headers() {
8+
# return [
9+
# {
10+
# source: '/:path*',
11+
# headers: [
12+
# {
13+
# key: 'x-custom-header',
14+
# value: 'js-config-value',
15+
# },
16+
# {
17+
# key: 'x-config-type',
18+
# value: 'object',
19+
# },
20+
# ],
21+
# },
22+
# ];
23+
# },
24+
# };
2525

26-
module.exports = nextConfig;
27-
file: next.config.js
28-
- name: with-js-config-function-style
29-
config: |
30-
/** @type {import('next').NextConfig} */
31-
const nextConfig = (phase, { defaultConfig }) => {
32-
return {
33-
reactStrictMode: true,
34-
async headers() {
35-
return [
36-
{
37-
source: '/:path*',
38-
headers: [
39-
{
40-
key: 'x-custom-header',
41-
value: 'js-config-value',
42-
},
43-
{
44-
key: 'x-config-type',
45-
value: 'function',
46-
},
47-
],
48-
},
49-
];
50-
}
51-
};
52-
};
26+
# module.exports = nextConfig;
27+
# file: next.config.js
28+
# - name: with-js-config-function-style
29+
# config: |
30+
# /** @type {import('next').NextConfig} */
31+
# const nextConfig = (phase, { defaultConfig }) => {
32+
# return {
33+
# reactStrictMode: true,
34+
# async headers() {
35+
# return [
36+
# {
37+
# source: '/:path*',
38+
# headers: [
39+
# {
40+
# key: 'x-custom-header',
41+
# value: 'js-config-value',
42+
# },
43+
# {
44+
# key: 'x-config-type',
45+
# value: 'function',
46+
# },
47+
# ],
48+
# },
49+
# ];
50+
# }
51+
# };
52+
# };
5353

54-
module.exports = nextConfig;
55-
file: next.config.js
56-
- name: with-js-async-function
57-
config: |
58-
// @ts-check
54+
# module.exports = nextConfig;
55+
# file: next.config.js
56+
# - name: with-js-async-function
57+
# config: |
58+
# // @ts-check
5959

60-
module.exports = async (phase, { defaultConfig }) => {
61-
/**
62-
* @type {import('next').NextConfig}
63-
*/
64-
const nextConfig = {
65-
async headers() {
66-
return [
67-
{
68-
source: '/:path*',
69-
headers: [
70-
{
71-
key: 'x-custom-header',
72-
value: 'js-config-value',
73-
},
74-
{
75-
key: 'x-config-type',
76-
value: 'function',
77-
},
78-
],
79-
},
80-
];
81-
}
82-
}
83-
return nextConfig
84-
}
85-
file: next.config.js
60+
# module.exports = async (phase, { defaultConfig }) => {
61+
# /**
62+
# * @type {import('next').NextConfig}
63+
# */
64+
# const nextConfig = {
65+
# async headers() {
66+
# return [
67+
# {
68+
# source: '/:path*',
69+
# headers: [
70+
# {
71+
# key: 'x-custom-header',
72+
# value: 'js-config-value',
73+
# },
74+
# {
75+
# key: 'x-config-type',
76+
# value: 'function',
77+
# },
78+
# ],
79+
# },
80+
# ];
81+
# }
82+
# }
83+
# return nextConfig
84+
# }
85+
# file: next.config.js
8686
- name: with-ts-config
8787
config: |
8888
import type { NextConfig } from 'next'
@@ -105,40 +105,40 @@ tests:
105105
106106
export default nextConfig
107107
file: next.config.ts
108-
- name: with-ecmascript-modules
109-
config: |
110-
// @ts-check
108+
# - name: with-ecmascript-modules
109+
# config: |
110+
# // @ts-check
111111

112-
/**
113-
* @type {import('next').NextConfig}
114-
*/
115-
const nextConfig = {
116-
/* config options here */
117-
async headers() {
118-
return [
119-
{
120-
source: '/:path*',
121-
headers: [
122-
{
123-
key: 'x-custom-header',
124-
value: 'mjs-config-value',
125-
},
126-
],
127-
},
128-
];
129-
}
130-
}
112+
# /**
113+
# * @type {import('next').NextConfig}
114+
# */
115+
# const nextConfig = {
116+
# /* config options here */
117+
# async headers() {
118+
# return [
119+
# {
120+
# source: '/:path*',
121+
# headers: [
122+
# {
123+
# key: 'x-custom-header',
124+
# value: 'mjs-config-value',
125+
# },
126+
# ],
127+
# },
128+
# ];
129+
# }
130+
# }
131131

132-
export default nextConfig
133-
file: next.config.mjs
134-
- name: with-empty-config
135-
config: |
136-
// @ts-check
132+
# export default nextConfig
133+
# file: next.config.mjs
134+
# - name: with-empty-config
135+
# config: |
136+
# // @ts-check
137137

138-
/** @type {import('next').NextConfig} */
139-
const nextConfig = {
140-
/* config options here */
141-
}
138+
# /** @type {import('next').NextConfig} */
139+
# const nextConfig = {
140+
# /* config options here */
141+
# }
142142

143-
module.exports = nextConfig
144-
file: next.config.js
143+
# module.exports = nextConfig
144+
# file: next.config.js

packages/@apphosting/adapter-nextjs/e2e/config-override.spec.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,7 @@ describe("next.config override", () => {
5858

5959
// Check for the custom header that was set in the next.config
6060
const customHeader = response.headers.get("x-custom-header") ?? "";
61-
const validValues = [
62-
"js-config-value",
63-
"ts-config-value",
64-
"mjs-config-value",
65-
"complex-config-value",
66-
];
61+
const validValues = ["js-config-value", "ts-config-value", "mjs-config-value"];
6762
assert.ok(
6863
validValues.includes(customHeader),
6964
`Expected header to be one of ${validValues.join(", ")} but got "${customHeader}"`,
@@ -84,11 +79,7 @@ describe("next.config override", () => {
8479

8580
it("should handle object-style config correctly", async function () {
8681
// Only run this test for scenarios with object-style config
87-
if (
88-
!scenario.includes("object-style") &&
89-
!scenario.includes("with-complex-config") &&
90-
!scenario.includes("with-empty-config")
91-
) {
82+
if (!scenario.includes("object-style") && !scenario.includes("with-empty-config")) {
9283
this.skip();
9384
}
9485

packages/@apphosting/adapter-nextjs/e2e/run-local.ts

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,33 +25,33 @@ const configOverrideTestScenarios = parseYaml(
2525
).tests;
2626

2727
const scenarios: Scenario[] = [
28-
{
29-
name: "basic",
30-
// No setup needed for basic scenario
31-
tests: ["app.spec.ts"],
32-
},
33-
{
34-
name: "with-middleware",
35-
setup: async (cwd: string) => {
36-
// Create a middleware.ts file
37-
const middlewareContent = `
38-
import type { NextRequest } from 'next/server'
39-
40-
export function middleware(request: NextRequest) {
41-
// This is a simple middleware that doesn't modify the request
42-
console.log('Middleware executed', request.nextUrl.pathname);
43-
}
44-
45-
export const config = {
46-
matcher: '/((?!api|_next/static|_next/image|favicon.ico).*)',
47-
};
48-
`;
49-
50-
await fsExtra.writeFile(join(cwd, "src", "middleware.ts"), middlewareContent);
51-
console.log(`Created middleware.ts file`);
52-
},
53-
tests: ["middleware.spec.ts"], // Only run middleware-specific tests
54-
},
28+
// {
29+
// name: "basic",
30+
// // No setup needed for basic scenario
31+
// tests: ["app.spec.ts"],
32+
// },
33+
// {
34+
// name: "with-middleware",
35+
// setup: async (cwd: string) => {
36+
// // Create a middleware.ts file
37+
// const middlewareContent = `
38+
// import type { NextRequest } from 'next/server'
39+
40+
// export function middleware(request: NextRequest) {
41+
// // This is a simple middleware that doesn't modify the request
42+
// console.log('Middleware executed', request.nextUrl.pathname);
43+
// }
44+
45+
// export const config = {
46+
// matcher: '/((?!api|_next/static|_next/image|favicon.ico).*)',
47+
// };
48+
// `;
49+
50+
// await fsExtra.writeFile(join(cwd, "src", "middleware.ts"), middlewareContent);
51+
// console.log(`Created middleware.ts file`);
52+
// },
53+
// tests: ["middleware.spec.ts"], // Only run middleware-specific tests
54+
// },
5555
...configOverrideTestScenarios.map(
5656
(scenario: { name: string; config: string; file: string }) => ({
5757
name: scenario.name,

0 commit comments

Comments
 (0)