Skip to content

Commit d78a38d

Browse files
committed
Merge branch 'master' of https://github.com/nveenjain/graphql-js into feature/addCommentInAST
Signed-off-by: Naveen Jain <[email protected]>
2 parents 5a5825c + 688f93c commit d78a38d

18 files changed

+357
-367
lines changed

.eslintrc.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ overrides:
433433
flowtype/require-valid-file-annotation: off
434434

435435
##########################################################################
436-
# `@typescript-eslint/eslint-plugin` rule list based on `v2.17.x`
436+
# `@typescript-eslint/eslint-plugin` rule list based on `v2.21.x`
437437
##########################################################################
438438

439439
# Supported Rules

.flowconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)?)\\)
4040
suppress_comment=\\(.\\|\n\\)*\\$DisableFlowOnNegativeTest
4141

4242
[version]
43-
^0.118.0
43+
^0.119.0

package.json

+11-11
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,23 @@
4444
},
4545
"dependencies": {},
4646
"devDependencies": {
47-
"@babel/core": "7.8.4",
47+
"@babel/core": "7.8.6",
4848
"@babel/plugin-transform-flow-strip-types": "7.8.3",
49-
"@babel/preset-env": "7.8.4",
50-
"@babel/register": "7.8.3",
51-
"@typescript-eslint/eslint-plugin": "2.19.2",
52-
"@typescript-eslint/parser": "2.19.2",
53-
"babel-eslint": "10.0.3",
49+
"@babel/preset-env": "7.8.6",
50+
"@babel/register": "7.8.6",
51+
"@typescript-eslint/eslint-plugin": "2.21.0",
52+
"@typescript-eslint/parser": "2.21.0",
53+
"babel-eslint": "10.1.0",
5454
"chai": "4.2.0",
55-
"cspell": "4.0.46",
56-
"dtslint": "2.0.6",
55+
"cspell": "4.0.55",
56+
"dtslint": "3.2.0",
5757
"eslint": "6.8.0",
5858
"eslint-plugin-flowtype": "4.6.0",
5959
"eslint-plugin-import": "2.20.1",
60-
"flow-bin": "0.118.0",
61-
"mocha": "7.0.1",
60+
"flow-bin": "0.119.1",
61+
"mocha": "7.1.0",
6262
"nyc": "15.0.0",
6363
"prettier": "1.19.1",
64-
"typescript": "^3.7.5"
64+
"typescript": "^3.8.3"
6565
}
6666
}

src/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Each sub directory within is a sub-module of graphql-js:
1717
fulfilling a GraphQL result.
1818
- [`graphql/execution`](execution/README.md): The Execution phase of fulfilling
1919
a GraphQL request.
20-
- [`graphql/error`](error/README.md): Creating and formating GraphQL errors.
20+
- [`graphql/error`](error/README.md): Creating and formatting GraphQL errors.
2121
- [`graphql/utilities`](utilities/README.md): Common useful computations upon
2222
the GraphQL language and type objects.
2323
- [`graphql/subscription`](subscription/README.md): Subscribe to data updates.

src/__tests__/graphql-test.js

-18
This file was deleted.

src/execution/__tests__/sync-test.js

+11
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,17 @@ describe('Execute: synchronously when possible', () => {
9393
});
9494

9595
describe('graphqlSync', () => {
96+
it('report errors raised during schema validation', () => {
97+
const badSchema = new GraphQLSchema({});
98+
const result = graphqlSync({
99+
schema: badSchema,
100+
source: '{ __typename }',
101+
});
102+
expect(result).to.deep.equal({
103+
errors: [{ message: 'Query root type must be provided.' }],
104+
});
105+
});
106+
96107
it('does not return a Promise for syntax errors', () => {
97108
const doc = 'fragment Example on Query { { { syncField }';
98109
const result = graphqlSync({

src/language/__tests__/parser-test.js

+19-16
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,13 @@ describe('Parser', () => {
153153
type alpha{ field(arg: string):string }
154154
`);
155155

156-
expect(ast).to.have.nested.property(
157-
'comments[0].value',
158-
'This comment has a \u0A0A multi-byte character.',
159-
);
160-
expect(ast.comments).to.have.length(1);
156+
expect(toJSONDeep(ast.comments)).to.deep.equal([
157+
{
158+
kind: 'Comment',
159+
loc: { start: 7, end: 50 },
160+
value: 'This comment has a ਊ multi-byte character.',
161+
},
162+
]);
161163
});
162164

163165
it('Add multiple comments in AST', () => {
@@ -169,15 +171,18 @@ describe('Parser', () => {
169171
}
170172
`);
171173

172-
expect(ast).to.have.nested.property(
173-
'comments[0].value',
174-
'This comment is demo comment.',
175-
);
176-
expect(ast).to.have.nested.property(
177-
'comments[1].value',
178-
'This is another demo comment having # inside',
179-
);
180-
expect(ast.comments).to.have.length(2);
174+
expect(toJSONDeep(ast.comments)).to.deep.equal([
175+
{
176+
kind: 'Comment',
177+
loc: { start: 27, end: 57 },
178+
value: 'This comment is demo comment.',
179+
},
180+
{
181+
kind: 'Comment',
182+
loc: { start: 101, end: 146 },
183+
value: 'This is another demo comment having # inside',
184+
},
185+
]);
181186
});
182187

183188
it('parses kitchen sink', () => {
@@ -264,7 +269,6 @@ describe('Parser', () => {
264269

265270
expect(toJSONDeep(result)).to.deep.equal({
266271
kind: Kind.DOCUMENT,
267-
comments: [],
268272
loc: { start: 0, end: 41 },
269273
definitions: [
270274
{
@@ -355,7 +359,6 @@ describe('Parser', () => {
355359

356360
expect(toJSONDeep(result)).to.deep.equal({
357361
kind: Kind.DOCUMENT,
358-
comments: [],
359362
loc: { start: 0, end: 30 },
360363
definitions: [
361364
{

src/language/__tests__/schema-parser-test.js

-29
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ describe('Schema Parser', () => {
7979

8080
expect(toJSONDeep(doc)).to.deep.equal({
8181
kind: 'Document',
82-
comments: [],
8382
definitions: [
8483
{
8584
kind: 'ObjectTypeDefinition',
@@ -177,7 +176,6 @@ describe('Schema Parser', () => {
177176

178177
expect(toJSONDeep(doc)).to.deep.equal({
179178
kind: 'Document',
180-
comments: [],
181179
definitions: [
182180
{
183181
kind: 'ObjectTypeExtension',
@@ -203,7 +201,6 @@ describe('Schema Parser', () => {
203201

204202
expect(toJSONDeep(doc)).to.deep.equal({
205203
kind: 'Document',
206-
comments: [],
207204
definitions: [
208205
{
209206
kind: 'ObjectTypeExtension',
@@ -222,7 +219,6 @@ describe('Schema Parser', () => {
222219
const doc = parse('extend interface Hello implements Greeting');
223220
expect(toJSONDeep(doc)).to.deep.equal({
224221
kind: 'Document',
225-
comments: [],
226222
definitions: [
227223
{
228224
kind: 'InterfaceTypeExtension',
@@ -246,7 +242,6 @@ describe('Schema Parser', () => {
246242

247243
expect(toJSONDeep(doc)).to.deep.equal({
248244
kind: 'Document',
249-
comments: [],
250245
definitions: [
251246
{
252247
kind: 'ObjectTypeExtension',
@@ -309,7 +304,6 @@ describe('Schema Parser', () => {
309304
`);
310305
expect(toJSONDeep(doc)).to.deep.equal({
311306
kind: 'Document',
312-
comments: [],
313307
definitions: [
314308
{
315309
kind: 'InterfaceTypeExtension',
@@ -382,7 +376,6 @@ describe('Schema Parser', () => {
382376
const doc = parse(body);
383377
expect(toJSONDeep(doc)).to.deep.equal({
384378
kind: 'Document',
385-
comments: [],
386379
definitions: [
387380
{
388381
kind: 'SchemaExtension',
@@ -407,7 +400,6 @@ describe('Schema Parser', () => {
407400
const doc = parse(body);
408401
expect(toJSONDeep(doc)).to.deep.equal({
409402
kind: 'Document',
410-
comments: [],
411403
definitions: [
412404
{
413405
kind: 'SchemaExtension',
@@ -450,7 +442,6 @@ describe('Schema Parser', () => {
450442

451443
expect(toJSONDeep(doc)).to.deep.equal({
452444
kind: 'Document',
453-
comments: [],
454445
definitions: [
455446
{
456447
kind: 'ObjectTypeDefinition',
@@ -480,7 +471,6 @@ describe('Schema Parser', () => {
480471
const doc = parse('interface Hello implements World { field: String }');
481472
expect(toJSONDeep(doc)).to.deep.equal({
482473
kind: 'Document',
483-
comments: [],
484474
definitions: [
485475
{
486476
kind: 'InterfaceTypeDefinition',
@@ -507,7 +497,6 @@ describe('Schema Parser', () => {
507497

508498
expect(toJSONDeep(doc)).to.deep.equal({
509499
kind: 'Document',
510-
comments: [],
511500
definitions: [
512501
{
513502
kind: 'ObjectTypeDefinition',
@@ -534,7 +523,6 @@ describe('Schema Parser', () => {
534523

535524
expect(toJSONDeep(doc)).to.deep.equal({
536525
kind: 'Document',
537-
comments: [],
538526
definitions: [
539527
{
540528
kind: 'ObjectTypeDefinition',
@@ -563,7 +551,6 @@ describe('Schema Parser', () => {
563551
const doc = parse('interface Hello implements Wo & rld { field: String }');
564552
expect(toJSONDeep(doc)).to.deep.equal({
565553
kind: 'Document',
566-
comments: [],
567554
definitions: [
568555
{
569556
kind: 'InterfaceTypeDefinition',
@@ -593,7 +580,6 @@ describe('Schema Parser', () => {
593580

594581
expect(toJSONDeep(doc)).to.deep.equal({
595582
kind: 'Document',
596-
comments: [],
597583
definitions: [
598584
{
599585
kind: 'ObjectTypeDefinition',
@@ -624,7 +610,6 @@ describe('Schema Parser', () => {
624610
);
625611
expect(toJSONDeep(doc)).to.deep.equal({
626612
kind: 'Document',
627-
comments: [],
628613
definitions: [
629614
{
630615
kind: 'InterfaceTypeDefinition',
@@ -654,7 +639,6 @@ describe('Schema Parser', () => {
654639

655640
expect(toJSONDeep(doc)).to.deep.equal({
656641
kind: 'Document',
657-
comments: [],
658642
definitions: [
659643
{
660644
kind: 'EnumTypeDefinition',
@@ -674,7 +658,6 @@ describe('Schema Parser', () => {
674658

675659
expect(toJSONDeep(doc)).to.deep.equal({
676660
kind: 'Document',
677-
comments: [],
678661
definitions: [
679662
{
680663
kind: 'EnumTypeDefinition',
@@ -701,7 +684,6 @@ describe('Schema Parser', () => {
701684

702685
expect(toJSONDeep(doc)).to.deep.equal({
703686
kind: 'Document',
704-
comments: [],
705687
definitions: [
706688
{
707689
kind: 'InterfaceTypeDefinition',
@@ -732,7 +714,6 @@ describe('Schema Parser', () => {
732714

733715
expect(toJSONDeep(doc)).to.deep.equal({
734716
kind: 'Document',
735-
comments: [],
736717
definitions: [
737718
{
738719
kind: 'ObjectTypeDefinition',
@@ -771,7 +752,6 @@ describe('Schema Parser', () => {
771752

772753
expect(toJSONDeep(doc)).to.deep.equal({
773754
kind: 'Document',
774-
comments: [],
775755
definitions: [
776756
{
777757
kind: 'ObjectTypeDefinition',
@@ -814,7 +794,6 @@ describe('Schema Parser', () => {
814794

815795
expect(toJSONDeep(doc)).to.deep.equal({
816796
kind: 'Document',
817-
comments: [],
818797
definitions: [
819798
{
820799
kind: 'ObjectTypeDefinition',
@@ -857,7 +836,6 @@ describe('Schema Parser', () => {
857836

858837
expect(toJSONDeep(doc)).to.deep.equal({
859838
kind: 'Document',
860-
comments: [],
861839
definitions: [
862840
{
863841
kind: 'ObjectTypeDefinition',
@@ -898,7 +876,6 @@ describe('Schema Parser', () => {
898876

899877
expect(toJSONDeep(doc)).to.deep.equal({
900878
kind: 'Document',
901-
comments: [],
902879
definitions: [
903880
{
904881
kind: 'UnionTypeDefinition',
@@ -918,7 +895,6 @@ describe('Schema Parser', () => {
918895

919896
expect(toJSONDeep(doc)).to.deep.equal({
920897
kind: 'Document',
921-
comments: [],
922898
definitions: [
923899
{
924900
kind: 'UnionTypeDefinition',
@@ -941,7 +917,6 @@ describe('Schema Parser', () => {
941917

942918
expect(toJSONDeep(doc)).to.deep.equal({
943919
kind: 'Document',
944-
comments: [],
945920
definitions: [
946921
{
947922
kind: 'UnionTypeDefinition',
@@ -992,7 +967,6 @@ describe('Schema Parser', () => {
992967

993968
expect(toJSONDeep(doc)).to.deep.equal({
994969
kind: 'Document',
995-
comments: [],
996970
definitions: [
997971
{
998972
kind: 'ScalarTypeDefinition',
@@ -1014,7 +988,6 @@ input Hello {
1014988

1015989
expect(toJSONDeep(doc)).to.deep.equal({
1016990
kind: 'Document',
1017-
comments: [],
1018991
definitions: [
1019992
{
1020993
kind: 'InputObjectTypeDefinition',
@@ -1053,7 +1026,6 @@ input Hello {
10531026

10541027
expect(toJSONDeep(doc)).to.deep.equal({
10551028
kind: 'Document',
1056-
comments: [],
10571029
definitions: [
10581030
{
10591031
kind: 'DirectiveDefinition',
@@ -1090,7 +1062,6 @@ input Hello {
10901062

10911063
expect(toJSONDeep(doc)).to.deep.equal({
10921064
kind: 'Document',
1093-
comments: [],
10941065
definitions: [
10951066
{
10961067
kind: 'DirectiveDefinition',

0 commit comments

Comments
 (0)