Skip to content

Commit 85fff1d

Browse files
committed
update integration tests
1 parent c0cb914 commit 85fff1d

File tree

42 files changed

+596
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+596
-1
lines changed

integrationTests/README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,31 @@
1-
# TBD
1+
# Integration Tests
2+
3+
This directory contains integration tests for GraphQL.js across different environments and bundlers, testing both development mode and production mode functionality.
4+
5+
## Test Structure
6+
7+
Each subdirectory represents a different environment/bundler:
8+
9+
- `node/` - Node.js runtime tests
10+
- `deno/` - Deno runtime tests
11+
- `bun/` - Bun runtime tests
12+
- `webpack/` - Webpack bundler tests
13+
- `rollup/` - Rollup bundler tests
14+
- `esbuild/` - esbuild bundler tests
15+
- `vite/` - Vite bundler tests
16+
- `nextjs/` - Next.js framework tests
17+
- `create-react-app/` - Create React App tests
18+
- `swc/` - SWC bundler tests
19+
20+
## Development Mode Testing
21+
22+
Each test verifies:
23+
24+
1. Development mode is properly enabled (explicit import or conditional exports)
25+
2. Production mode works without development overhead
26+
3. Multiple GraphQL.js module detection works in development
27+
4. Performance characteristics differ between modes
28+
29+
## Running Tests
30+
31+
Tests are run via the main integration test suite in `resources/integration-test.ts`.

integrationTests/dev-bun/package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"description": "graphql-js development condition should work with Bun",
3+
"private": true,
4+
"scripts": {
5+
"test": "docker run --rm --volume \"$PWD:/usr/src/app\" -w /usr/src/app oven/bun:latest bun --conditions=development test.js"
6+
},
7+
"dependencies": {
8+
"graphql": "file:../graphql.tgz"
9+
}
10+
}

integrationTests/dev-bun/test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { isObjectType } from 'graphql';
2+
3+
class GraphQLObjectType {
4+
get [Symbol.toStringTag]() {
5+
return 'GraphQLObjectType';
6+
}
7+
}
8+
9+
try {
10+
isObjectType(new GraphQLObjectType());
11+
throw new Error(
12+
'Expected isObjectType to throw an error in Deno explicit dev import mode.',
13+
);
14+
} catch (error) {
15+
if (!error.message.includes('from another module or realm')) {
16+
throw error;
17+
}
18+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"description": "graphql-js explicit development import should work with Deno",
3+
"private": true,
4+
"scripts": {
5+
"test": "docker run --rm --volume \"$PWD:/usr/src/app\" -w /usr/src/app denoland/deno:latest deno run test.js"
6+
},
7+
"dependencies": {
8+
"graphql": "file:../graphql.tgz"
9+
}
10+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// eslint-disable-next-line import/no-unassigned-import, simple-import-sort/imports
2+
import 'graphql/dev';
3+
import { isObjectType } from 'graphql';
4+
5+
class GraphQLObjectType {
6+
get [Symbol.toStringTag]() {
7+
return 'GraphQLObjectType';
8+
}
9+
}
10+
11+
try {
12+
isObjectType(new GraphQLObjectType());
13+
throw new Error(
14+
'Expected isObjectType to throw an error in Deno explicit dev import mode.',
15+
);
16+
} catch (error) {
17+
if (!error.message.includes('from another module or realm')) {
18+
throw error;
19+
}
20+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"description": "graphql-js development condition should work with Deno",
3+
"private": true,
4+
"scripts": {
5+
"test": "docker run --rm --volume \"$PWD:/usr/src/app\" -w /usr/src/app denoland/deno:latest deno run --unstable-node-conditions=development test.js"
6+
},
7+
"dependencies": {
8+
"graphql": "file:../graphql.tgz"
9+
}
10+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { isObjectType } from 'graphql';
2+
3+
class GraphQLObjectType {
4+
get [Symbol.toStringTag]() {
5+
return 'GraphQLObjectType';
6+
}
7+
}
8+
9+
try {
10+
isObjectType(new GraphQLObjectType());
11+
throw new Error(
12+
'Expected isObjectType to throw an error in Deno explicit dev import mode.',
13+
);
14+
} catch (error) {
15+
if (!error.message.includes('from another module or realm')) {
16+
throw error;
17+
}
18+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"description": "graphql-js development condition should work with esbuild",
3+
"private": true,
4+
"type": "module",
5+
"scripts": {
6+
"build": "esbuild src/index.js --bundle --outfile=dist/bundle.js --format=esm --conditions=development,module",
7+
"test": "npm run build && node dist/bundle.js"
8+
},
9+
"dependencies": {
10+
"graphql": "file:../graphql.tgz",
11+
"esbuild": "^0.20.0"
12+
}
13+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { isObjectType } from 'graphql';
2+
3+
class GraphQLObjectType {
4+
get [Symbol.toStringTag]() {
5+
return 'GraphQLObjectType';
6+
}
7+
}
8+
9+
try {
10+
isObjectType(new GraphQLObjectType());
11+
throw new Error(
12+
'Expected isObjectType to throw an error in Deno explicit dev import mode.',
13+
);
14+
} catch (error) {
15+
if (!error.message.includes('from another module or realm')) {
16+
throw error;
17+
}
18+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/* eslint-disable import/no-unassigned-import */
2+
import 'graphql/dev';
3+
import './test.js';

0 commit comments

Comments
 (0)