File tree Expand file tree Collapse file tree 37 files changed +141
-129
lines changed Expand file tree Collapse file tree 37 files changed +141
-129
lines changed Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " graphql-js-test-dev-bun" ,
3
- "description" : " Bun development mode integration test" ,
4
- "version" : " 1.0.0" ,
2
+ "description" : " graphql-js development condition should work with Bun" ,
5
3
"private" : true ,
6
4
"scripts" : {
7
5
"test" : " bun --conditions=development test.js"
Original file line number Diff line number Diff line change 1
- import assert from 'assert' ;
2
1
import { isObjectType } from 'graphql' ;
3
2
4
3
class GraphQLObjectType {
@@ -9,10 +8,14 @@ class GraphQLObjectType {
9
8
10
9
try {
11
10
isObjectType ( new GraphQLObjectType ( ) ) ;
12
- assert . fail ( 'Expected isObjectType to throw an error in Bun development mode.' ) ;
11
+ throw new Error ( 'Expected isObjectType to throw an error in Bun development mode.' ) ;
13
12
} catch ( error ) {
14
- assert . ok (
15
- error . message . includes ( 'multiple' ) || error . message . includes ( 'GraphQL' ) ,
16
- `Expected error message to include 'multiple' or 'GraphQL', but got: "${ error . message } "`
17
- ) ;
13
+ if ( error . message === 'Expected isObjectType to throw an error in Bun development mode.' ) {
14
+ throw error ;
15
+ }
16
+ if ( ! ( error . message . includes ( 'multiple' ) || error . message . includes ( 'GraphQL' ) ) ) {
17
+ throw new Error (
18
+ `Expected error message to include 'multiple' or 'GraphQL', but got: "${ error . message } "`
19
+ ) ;
20
+ }
18
21
}
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " graphql-js-test-dev-deno" ,
3
- "description" : " Deno development mode integration test" ,
4
- "version" : " 1.0.0" ,
2
+ "description" : " graphql-js development condition should work with Deno" ,
5
3
"private" : true ,
6
4
"scripts" : {
7
5
"test" : " deno run --unstable-node-conditions=development test.js"
Original file line number Diff line number Diff line change 1
- import assert from 'assert' ;
2
1
import { isObjectType } from 'graphql' ;
3
2
4
3
class GraphQLObjectType {
@@ -9,10 +8,14 @@ class GraphQLObjectType {
9
8
10
9
try {
11
10
isObjectType ( new GraphQLObjectType ( ) ) ;
12
- assert . fail ( 'Expected isObjectType to throw an error in Deno development mode.' ) ;
11
+ throw new Error ( 'Expected isObjectType to throw an error in Deno development mode.' ) ;
13
12
} catch ( error ) {
14
- assert . ok (
15
- error . message . includes ( 'multiple' ) || error . message . includes ( 'GraphQL' ) ,
16
- `Expected error message to include 'multiple' or 'GraphQL', but got: "${ error . message } "`
17
- ) ;
13
+ if ( error . message === 'Expected isObjectType to throw an error in Deno development mode.' ) {
14
+ throw error ;
15
+ }
16
+ if ( ! ( error . message . includes ( 'multiple' ) || error . message . includes ( 'GraphQL' ) ) ) {
17
+ throw new Error (
18
+ `Expected error message to include 'multiple' or 'GraphQL', but got: "${ error . message } "`
19
+ ) ;
20
+ }
18
21
}
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " graphql-js-test-dev-esbuild" ,
3
- "description" : " esbuild development mode integration test" ,
4
- "version" : " 1.0.0" ,
2
+ "description" : " graphql-js development condition should work with esbuild" ,
5
3
"private" : true ,
6
4
"type" : " module" ,
7
5
"scripts" : {
Original file line number Diff line number Diff line change 1
- import assert from 'assert' ;
2
1
import { isObjectType } from 'graphql' ;
3
2
4
3
class GraphQLObjectType {
@@ -9,10 +8,14 @@ class GraphQLObjectType {
9
8
10
9
try {
11
10
isObjectType ( new GraphQLObjectType ( ) ) ;
12
- assert . fail ( 'Expected isObjectType to throw an error in esbuild development mode.' ) ;
11
+ throw new Error ( 'Expected isObjectType to throw an error in esbuild development mode.' ) ;
13
12
} catch ( error ) {
14
- assert . ok (
15
- error . message . includes ( 'multiple' ) || error . message . includes ( 'GraphQL' ) ,
16
- `Expected error message to include 'multiple' or 'GraphQL', but got: "${ error . message } "`
17
- ) ;
13
+ if ( error . message === 'Expected isObjectType to throw an error in esbuild development mode.' ) {
14
+ throw error ;
15
+ }
16
+ if ( ! ( error . message . includes ( 'multiple' ) || error . message . includes ( 'GraphQL' ) ) ) {
17
+ throw new Error (
18
+ `Expected error message to include 'multiple' or 'GraphQL', but got: "${ error . message } "`
19
+ ) ;
20
+ }
18
21
}
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " graphql-js-test-dev-nextjs" ,
3
- "description" : " Next.js development mode integration test" ,
4
- "version" : " 1.0.0" ,
2
+ "description" : " graphql-js development condition should work with Next.js" ,
5
3
"private" : true ,
6
4
"scripts" : {
7
5
"build" : " next build" ,
Original file line number Diff line number Diff line change 1
- import assert from 'assert' ;
2
1
import { isObjectType } from 'graphql' ;
3
2
4
3
class GraphQLObjectType {
@@ -9,10 +8,14 @@ class GraphQLObjectType {
9
8
10
9
try {
11
10
isObjectType ( new GraphQLObjectType ( ) ) ;
12
- assert . fail ( 'Expected isObjectType to throw an error in Next.js development mode.' ) ;
11
+ throw new Error ( 'Expected isObjectType to throw an error in Next.js development mode.' ) ;
13
12
} catch ( error ) {
14
- assert . ok (
15
- error . message . includes ( 'multiple' ) || error . message . includes ( 'GraphQL' ) ,
16
- `Expected error message to include 'multiple' or 'GraphQL', but got: "${ error . message } "`
17
- ) ;
13
+ if ( error . message === 'Expected isObjectType to throw an error in Next.js development mode.' ) {
14
+ throw error ;
15
+ }
16
+ if ( ! ( error . message . includes ( 'multiple' ) || error . message . includes ( 'GraphQL' ) ) ) {
17
+ throw new Error (
18
+ `Expected error message to include 'multiple' or 'GraphQL', but got: "${ error . message } "`
19
+ ) ;
20
+ }
18
21
}
Original file line number Diff line number Diff line change @@ -8,12 +8,23 @@ class GraphQLObjectType {
8
8
9
9
try {
10
10
isObjectType ( new GraphQLObjectType ( ) ) ;
11
+ // If isObjectType did not throw, this line will be reached.
11
12
throw new Error (
12
13
'Expected isObjectType to throw an error in Node.js explicit development mode.' ,
13
14
) ;
14
15
} catch ( error ) {
15
- if (
16
- ! error . message . includes ( 'from another module or realm' ) ,
17
- `Expected error message to include 'from another module or realm', but got: "${ error . message } "` ,
18
- ) ;
16
+ // Case 1: The error is the one we threw from the 'try' block.
17
+ // This means isObjectType() itself did NOT throw an error.
18
+ if ( error . message === 'Expected isObjectType to throw an error in Node.js explicit development mode.' ) {
19
+ throw error ; // Re-throw this error to indicate the test failure.
20
+ }
21
+ // Case 2: isObjectType() itself threw an error. Now check if it's the correct error.
22
+ else if ( ! error . message . includes ( 'from another module or realm' ) ) {
23
+ // If the message does NOT include the expected text, then it's the wrong error.
24
+ throw new Error (
25
+ `Expected error message to include 'from another module or realm', but got: "${ error . message } "`
26
+ ) ;
27
+ }
28
+ // If none of the above, it means isObjectType() threw an error, AND that error's message was correct.
29
+ // So, the test passes by not throwing anything further from the catch block.
19
30
}
Original file line number Diff line number Diff line change 1
1
{
2
- "private" : true ,
3
2
"description" : " graphql-js development condition should work with node" ,
3
+ "private" : true ,
4
4
"type" : " module" ,
5
5
"scripts" : {
6
6
"test" : " node --conditions=development test.js"
Original file line number Diff line number Diff line change 1
- import assert from 'node:assert' ;
2
-
3
1
import { isObjectType } from 'graphql' ;
4
2
5
3
class GraphQLObjectType {
@@ -10,12 +8,16 @@ class GraphQLObjectType {
10
8
11
9
try {
12
10
isObjectType ( new GraphQLObjectType ( ) ) ;
13
- assert . fail (
11
+ throw new Error (
14
12
'Expected isObjectType to throw an error in Node.js implicit development mode.' ,
15
13
) ;
16
14
} catch ( error ) {
17
- assert . ok (
18
- error . message . includes ( 'multiple' ) || error . message . includes ( 'GraphQL' ) ,
19
- `Expected error message to include 'multiple' or 'GraphQL', but got: "${ error . message } "` ,
20
- ) ;
15
+ if ( error . message === 'Expected isObjectType to throw an error in Node.js implicit development mode.' ) {
16
+ throw error ;
17
+ }
18
+ if ( ! ( error . message . includes ( 'multiple' ) || error . message . includes ( 'GraphQL' ) ) ) {
19
+ throw new Error (
20
+ `Expected error message to include 'multiple' or 'GraphQL', but got: "${ error . message } "`
21
+ ) ;
22
+ }
21
23
}
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " graphql-js-test-dev-rollup" ,
3
- "description" : " Rollup development mode integration test" ,
4
- "version" : " 1.0.0" ,
2
+ "description" : " graphql-js development condition should work with Rollup" ,
5
3
"private" : true ,
6
4
"type" : " module" ,
7
5
"scripts" : {
Original file line number Diff line number Diff line change 1
- import assert from 'assert' ;
2
1
import { isObjectType } from 'graphql' ;
3
2
4
3
class GraphQLObjectType {
@@ -9,10 +8,14 @@ class GraphQLObjectType {
9
8
10
9
try {
11
10
isObjectType ( new GraphQLObjectType ( ) ) ;
12
- assert . fail ( 'Expected isObjectType to throw an error in Rollup development mode.' ) ;
11
+ throw new Error ( 'Expected isObjectType to throw an error in Rollup development mode.' ) ;
13
12
} catch ( error ) {
14
- assert . ok (
15
- error . message . includes ( 'multiple' ) || error . message . includes ( 'GraphQL' ) ,
16
- `Expected error message to include 'multiple' or 'GraphQL', but got: "${ error . message } "`
17
- ) ;
13
+ if ( error . message === 'Expected isObjectType to throw an error in Rollup development mode.' ) {
14
+ throw error ;
15
+ }
16
+ if ( ! ( error . message . includes ( 'multiple' ) || error . message . includes ( 'GraphQL' ) ) ) {
17
+ throw new Error (
18
+ `Expected error message to include 'multiple' or 'GraphQL', but got: "${ error . message } "`
19
+ ) ;
20
+ }
18
21
}
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " graphql-js-test-dev-swc" ,
3
- "description" : " SWC development mode integration test" ,
4
- "version" : " 1.0.0" ,
2
+ "description" : " graphql-js development condition should work with SWC" ,
5
3
"private" : true ,
6
4
"type" : " module" ,
7
5
"scripts" : {
Original file line number Diff line number Diff line change 1
- import assert from 'assert' ;
2
1
import { isObjectType } from 'graphql' ;
3
2
4
3
class GraphQLObjectType {
@@ -9,10 +8,14 @@ class GraphQLObjectType {
9
8
10
9
try {
11
10
isObjectType ( new GraphQLObjectType ( ) ) ;
12
- assert . fail ( 'Expected isObjectType to throw an error in SWC development mode.' ) ;
11
+ throw new Error ( 'Expected isObjectType to throw an error in SWC development mode.' ) ;
13
12
} catch ( error ) {
14
- assert . ok (
15
- error . message . includes ( 'multiple' ) || error . message . includes ( 'GraphQL' ) ,
16
- `Expected error message to include 'multiple' or 'GraphQL', but got: "${ error . message } "`
17
- ) ;
13
+ if ( error . message === 'Expected isObjectType to throw an error in SWC development mode.' ) {
14
+ throw error ;
15
+ }
16
+ if ( ! ( error . message . includes ( 'multiple' ) || error . message . includes ( 'GraphQL' ) ) ) {
17
+ throw new Error (
18
+ `Expected error message to include 'multiple' or 'GraphQL', but got: "${ error . message } "`
19
+ ) ;
20
+ }
18
21
}
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " graphql-js-test-dev-vite" ,
3
- "description" : " Vite development mode integration test" ,
4
- "version" : " 1.0.0" ,
2
+ "description" : " graphql-js development condition should work with Vite" ,
5
3
"private" : true ,
6
4
"type" : " module" ,
7
5
"scripts" : {
Original file line number Diff line number Diff line change 1
- import assert from 'assert' ;
2
1
import { isObjectType } from 'graphql' ;
3
2
4
3
class GraphQLObjectType {
@@ -9,10 +8,14 @@ class GraphQLObjectType {
9
8
10
9
try {
11
10
isObjectType ( new GraphQLObjectType ( ) ) ;
12
- assert . fail ( 'Expected isObjectType to throw an error in Vite development mode.' ) ;
11
+ throw new Error ( 'Expected isObjectType to throw an error in Vite development mode.' ) ;
13
12
} catch ( error ) {
14
- assert . ok (
15
- error . message . includes ( 'multiple' ) || error . message . includes ( 'GraphQL' ) ,
16
- `Expected error message to include 'multiple' or 'GraphQL', but got: "${ error . message } "`
17
- ) ;
13
+ if ( error . message === 'Expected isObjectType to throw an error in Vite development mode.' ) {
14
+ throw error ;
15
+ }
16
+ if ( ! ( error . message . includes ( 'multiple' ) || error . message . includes ( 'GraphQL' ) ) ) {
17
+ throw new Error (
18
+ `Expected error message to include 'multiple' or 'GraphQL', but got: "${ error . message } "`
19
+ ) ;
20
+ }
18
21
}
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " graphql-js-test-dev-webpack" ,
3
- "description" : " Webpack development mode integration test" ,
4
- "version" : " 1.0.0" ,
2
+ "description" : " graphql-js development condition should work with Webpack" ,
5
3
"private" : true ,
6
4
"scripts" : {
7
5
"test" : " webpack --mode=development && node dist/main.js"
Original file line number Diff line number Diff line change 1
- import assert from 'assert' ;
2
1
import { isObjectType } from 'graphql' ;
3
2
4
3
class GraphQLObjectType {
@@ -9,10 +8,14 @@ class GraphQLObjectType {
9
8
10
9
try {
11
10
isObjectType ( new GraphQLObjectType ( ) ) ;
12
- assert . fail ( 'Expected isObjectType to throw an error in Webpack development mode.' ) ;
11
+ throw new Error ( 'Expected isObjectType to throw an error in Webpack development mode.' ) ;
13
12
} catch ( error ) {
14
- assert . ok (
15
- error . message . includes ( 'multiple' ) || error . message . includes ( 'GraphQL' ) ,
16
- `Expected error message to include 'multiple' or 'GraphQL', but got: "${ error . message } "`
17
- ) ;
13
+ if ( error . message === 'Expected isObjectType to throw an error in Webpack development mode.' ) {
14
+ throw error ;
15
+ }
16
+ if ( ! ( error . message . includes ( 'multiple' ) || error . message . includes ( 'GraphQL' ) ) ) {
17
+ throw new Error (
18
+ `Expected error message to include 'multiple' or 'GraphQL', but got: "${ error . message } "`
19
+ ) ;
20
+ }
18
21
}
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " graphql-js-test-prod-bun" ,
3
- "description" : " Bun production mode integration test" ,
4
- "version" : " 1.0.0" ,
2
+ "description" : " graphql-js production mode should work with Bun" ,
5
3
"private" : true ,
6
4
"scripts" : {
7
5
"test" : " bun test.js"
Original file line number Diff line number Diff line change 1
- import assert from 'assert' ;
2
1
import { isObjectType } from 'graphql' ;
3
2
4
3
class GraphQLObjectType {
@@ -8,4 +7,6 @@ class GraphQLObjectType {
8
7
}
9
8
10
9
const result = isObjectType ( new GraphQLObjectType ( ) ) ;
11
- assert . strictEqual ( result , false , 'isObjectType should return false in Bun production mode.' ) ;
10
+ if ( result !== false ) {
11
+ throw new Error ( 'isObjectType should return false in Bun production mode.' ) ;
12
+ }
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " graphql-js-test-prod-deno" ,
3
- "description" : " Deno production mode integration test" ,
4
- "version" : " 1.0.0" ,
2
+ "description" : " graphql-js production mode should work with Deno" ,
5
3
"private" : true ,
6
4
"scripts" : {
7
5
"test" : " deno run test.js"
Original file line number Diff line number Diff line change 1
- import assert from 'assert' ;
2
1
import { isObjectType } from 'graphql' ;
3
2
4
3
class GraphQLObjectType {
@@ -8,4 +7,6 @@ class GraphQLObjectType {
8
7
}
9
8
10
9
const result = isObjectType ( new GraphQLObjectType ( ) ) ;
11
- assert . strictEqual ( result , false , 'isObjectType should return false in Deno production mode.' ) ;
10
+ if ( result !== false ) {
11
+ throw new Error ( 'isObjectType should return false in Deno production mode.' ) ;
12
+ }
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " graphql-js-test-prod-esbuild" ,
3
- "description" : " esbuild production mode integration test" ,
4
- "version" : " 1.0.0" ,
2
+ "description" : " graphql-js production mode should work with esbuild" ,
5
3
"private" : true ,
6
4
"type" : " module" ,
7
5
"scripts" : {
You can’t perform that action at this time.
0 commit comments