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
4 changes: 2 additions & 2 deletions examples/file-upload-nextjs-pothos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
"@pothos/core": "4.10.0",
"graphql": "16.12.0",
"graphql-yoga": "workspace:*",
"next": "15.5.6",
"next": "16.0.1",
"react": "19.2.0",
"react-dom": "19.2.0"
},
"devDependencies": {
"@types/react": "^19.0.0",
"@whatwg-node/fetch": "^0.10.1",
"eslint": "9.39.0",
"eslint-config-next": "15.5.6",
"eslint-config-next": "16.0.1",
"typescript": "5.9.3"
}
}
15 changes: 12 additions & 3 deletions examples/nextjs-app/__integration-tests__/nextjs-app.spec.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
import path from 'node:path';
import { version } from 'graphql';
import { rimrafSync } from 'rimraf';
import { fetch } from '@whatwg-node/fetch';
import { getAvailablePort, Proc, spawn, waitForAvailable } from './utils';

jest.setTimeout(33_000);

const nodeMajorVersion = parseInt(process.version.split('.')[0].replace('v', ''), 10);

describe('nextjs 13 App Router', () => {
if (version.startsWith('15.')) {
it.skip('skips for v15', () => {});
if (version.startsWith('15.') || nodeMajorVersion < 20) {
it.skip('skips', () => {});
return;
}
let port: number;
let serverProcess: Proc;
beforeAll(async () => {
rimrafSync(path.join(__dirname, '..', '.next'));
const signal = AbortSignal.timeout(30_000);
port = await getAvailablePort();
serverProcess = await spawn('pnpm', ['dev'], {
signal,
env: { PORT: String(port) },
cwd: path.join(__dirname, '..'),
});
await waitForAvailable(port, { signal });
});
afterAll(() => serverProcess?.kill());
afterAll(() => {
rimrafSync(path.join(__dirname, '..', '.next'));
return serverProcess?.kill();
});

it('should show GraphiQL', async () => {
const response = await fetch(`http://127.0.0.1:${port}/api/graphql`, {
Expand Down
8 changes: 6 additions & 2 deletions examples/nextjs-app/__integration-tests__/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ export interface Proc {
export function spawn(
cmd: string,
args: string[],
{ signal, env }: { signal: AbortSignal; env?: Record<string, string> },
{
signal,
env,
cwd = path.join(module.path, '..'),
}: { signal: AbortSignal; env?: Record<string, string>; cwd: string },
): Promise<Proc> {
const proc = cp.spawn(cmd, args, {
// ignore stdin because we're not feeding the process anything, pipe stdout and stderr
stdio: ['ignore', 'pipe', 'pipe'],
cwd: path.join(module.path, '..'),
cwd,
signal,
env: {
// @ts-ignore this runs inside jest so process is always available
Expand Down
1 change: 1 addition & 0 deletions examples/nextjs-app/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import './.next/dev/types/routes.d.ts';

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
4 changes: 2 additions & 2 deletions examples/nextjs-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"@types/react-dom": "19.2.2",
"autoprefixer": "10.4.21",
"eslint": "9.39.0",
"eslint-config-next": "15.5.6",
"eslint-config-next": "16.0.1",
"graphql": "16.12.0",
"graphql-yoga": "workspace:*",
"next": "15.5.6",
"next": "16.0.1",
"postcss": "8.5.6",
"react": "19.2.0",
"react-dom": "19.2.0",
Expand Down
11 changes: 9 additions & 2 deletions examples/nextjs-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"jsx": "react-jsx",
"incremental": true,
"plugins": [
{
Expand All @@ -23,6 +23,13 @@
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
".next/dev/types/**/*.ts",
".next/dev/dev/types/**/*.ts"
],
"exclude": ["node_modules"]
}
4 changes: 2 additions & 2 deletions examples/nextjs-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"graphql": "16.12.0",
"graphql-yoga": "workspace:*",
"next": "15.5.6",
"next": "16.0.1",
"next-auth": "4.24.13",
"react": "19.2.0",
"react-dom": "19.2.0",
Expand All @@ -21,7 +21,7 @@
"devDependencies": {
"@types/react": "19.2.2",
"eslint": "9.39.0",
"eslint-config-next": "15.5.6",
"eslint-config-next": "16.0.1",
"typescript": "5.9.3"
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import path from 'node:path';
import { rimrafSync } from 'rimraf';
import { fetch } from '@whatwg-node/fetch';
import {
getAvailablePort,
Expand All @@ -7,20 +9,30 @@ import {
} from '../../nextjs-app/__integration-tests__/utils';

jest.setTimeout(33_000);
const nodeMajorVersion = parseInt(process.version.split('.')[0].replace('v', ''), 10);

describe('NextJS Legacy Pages', () => {
if (nodeMajorVersion < 20) {
it.skip('skips', () => {});
return;
}
let port: number;
let serverProcess: Proc;
beforeAll(async () => {
rimrafSync(path.join(__dirname, '..', '.next'));
const signal = AbortSignal.timeout(30_000);
port = await getAvailablePort();
serverProcess = await spawn('pnpm', ['dev'], {
signal,
env: { PORT: String(port) },
cwd: path.join(__dirname, '..'),
});
await waitForAvailable(port, { signal });
});
afterAll(() => serverProcess.kill());
afterAll(() => {
rimrafSync(path.join(__dirname, '..', '.next'));
return serverProcess?.kill();
});

it('should show GraphiQL', async () => {
const response = await fetch(`http://127.0.0.1:${port}/api/graphql`, {
Expand All @@ -29,8 +41,8 @@ describe('NextJS Legacy Pages', () => {
},
});

expect(response.ok).toBe(true);
expect(await response.text()).toContain('<title>Yoga GraphiQL</title>');
expect(response.ok).toBe(true);
});

it('should run basic query', async () => {
Expand All @@ -46,8 +58,6 @@ describe('NextJS Legacy Pages', () => {
}),
});

expect(response.ok).toBe(true);

expect({
...Object.fromEntries(response.headers.entries()),
date: null,
Expand All @@ -60,5 +70,7 @@ describe('NextJS Legacy Pages', () => {

expect(json.errors).toBeFalsy();
expect(json.data?.greetings).toBe('This is the `greetings` field of the root `Query` type');

expect(response.ok).toBe(true);
});
});
3 changes: 2 additions & 1 deletion examples/nextjs-legacy-pages/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import './.next/dev/types/routes.d.ts';

// NOTE: This file should not be edited
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.
4 changes: 2 additions & 2 deletions examples/nextjs-legacy-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@types/react": "19.2.2",
"graphql": "16.12.0",
"graphql-yoga": "workspace:*",
"next": "15.5.6",
"next": "16.0.1",
"react": "19.2.0",
"react-dom": "19.2.0",
"tslib": "2.8.1"
Expand All @@ -24,7 +24,7 @@
"@types/react": "19.2.2",
"esbuild": "0.25.12",
"eslint": "9.39.0",
"eslint-config-next": "15.5.6",
"eslint-config-next": "16.0.1",
"typescript": "5.9.3"
}
}
7 changes: 7 additions & 0 deletions examples/nextjs-legacy-pages/pages/api/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,11 @@ export default createYoga<{
},
},
}),
plugins: [
{
onValidate({ setResult }) {
setResult([]);
},
},
],
});
2 changes: 1 addition & 1 deletion examples/nextjs-legacy-pages/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"jsx": "preserve",
"jsx": "react-jsx",
"importHelpers": true,
"isolatedModules": true
},
Expand Down
4 changes: 2 additions & 2 deletions examples/nextjs-ws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"graphql": "16.12.0",
"graphql-ws": "^6.0.0",
"graphql-yoga": "workspace:*",
"next": "15.5.6",
"next": "16.0.1",
"react": "19.2.0",
"react-dom": "19.2.0",
"ws": "8.18.3"
Expand All @@ -22,7 +22,7 @@
"@types/react": "19.2.2",
"@types/ws": "8.18.1",
"eslint": "9.39.0",
"eslint-config-next": "15.5.6",
"eslint-config-next": "16.0.1",
"typescript": "5.9.3"
}
}
4 changes: 2 additions & 2 deletions packages/graphql-yoga/__tests__/schema.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe('schema', () => {
expect(await result.json()).toEqual({
errors: [
{
message: `No schema found for this request. Make sure you use this plugin with GraphQL Yoga.`,
message: `The factory function did not return a valid GraphQLSchema.`,
},
],
});
Expand Down Expand Up @@ -228,7 +228,7 @@ describe('schema', () => {
const { errors } = await result.json();
expect(errors).toEqual([
{
message: `No schema found for this request. Make sure you use this plugin with GraphQL Yoga.`,
message: `The factory function did not return a valid GraphQLSchema.`,
},
]);
});
Expand Down
Loading
Loading