Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit c9e5640

Browse files
committed
test: fix failing test
1 parent 494d877 commit c9e5640

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

src/__tests__/http-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2190,7 +2190,7 @@ describe('GraphQL-HTTP tests for connect', () => {
21902190
expect(seenExecuteArgs).to.not.equal(null);
21912191
});
21922192

2193-
it.only('catches errors thrown from custom execute function', async () => {
2193+
it('catches errors thrown from custom execute function', async () => {
21942194
const app = server();
21952195

21962196
app.get(

src/index.ts

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,31 @@ import type { IncomingMessage, ServerResponse } from 'http';
22

33
import type {
44
DocumentNode,
5-
ValidationRule,
65
ExecutionArgs,
76
ExecutionResult,
87
FormattedExecutionResult,
9-
GraphQLSchema,
108
GraphQLFieldResolver,
11-
GraphQLTypeResolver,
129
GraphQLFormattedError,
10+
GraphQLSchema,
11+
GraphQLTypeResolver,
12+
ValidationRule,
1313
} from 'graphql';
14-
import accepts from 'accepts';
15-
import httpError from 'http-errors';
1614
import {
17-
Source,
15+
execute,
16+
getOperationAST,
1817
GraphQLError,
1918
parse,
19+
Source,
20+
specifiedRules,
2021
validate,
21-
execute,
2222
validateSchema,
23-
getOperationAST,
24-
specifiedRules,
2523
} from 'graphql';
24+
import accepts from 'accepts';
25+
import httpError from 'http-errors';
2626

27-
import type { GraphiQLOptions, GraphiQLData } from './renderGraphiQL';
28-
import { parseBody } from './parseBody';
27+
import type { GraphiQLData, GraphiQLOptions } from './renderGraphiQL';
2928
import { renderGraphiQL } from './renderGraphiQL';
29+
import { parseBody } from './parseBody';
3030

3131
// `url` is always defined for IncomingMessage coming from http.Server
3232
type Request = IncomingMessage & { url: string };
@@ -194,7 +194,15 @@ export function graphqlHTTP(options: Options): Middleware {
194194
let showGraphiQL = false;
195195
let graphiqlOptions: GraphiQLOptions | undefined;
196196
let formatErrorFn = (error: GraphQLError): GraphQLFormattedError =>
197-
new GraphQLError(error.message);
197+
new GraphQLError(
198+
error.message,
199+
error.nodes,
200+
error.source,
201+
error.positions,
202+
error.path,
203+
error.originalError,
204+
error.extensions,
205+
);
198206
let pretty = false;
199207
let result: ExecutionResult;
200208

0 commit comments

Comments
 (0)