@@ -16,6 +16,35 @@ import { readFileSync } from 'fs';
1616import { join } from 'path' ;
1717
1818describe ( 'Parser' , ( ) => {
19+
20+ it ( 'accepts option to not include source' , ( ) => {
21+ expect ( parse ( `{ field }` , { noSource : true } ) ) . to . deep . equal ( {
22+ kind : 'Document' ,
23+ loc : { start : 0 , end : 9 } ,
24+ definitions :
25+ [ { kind : 'OperationDefinition' ,
26+ loc : { start : 0 , end : 9 } ,
27+ operation : 'query' ,
28+ name : null ,
29+ variableDefinitions : null ,
30+ directives : [ ] ,
31+ selectionSet : {
32+ kind : 'SelectionSet' ,
33+ loc : { start : 0 , end : 9 } ,
34+ selections :
35+ [ { kind : 'Field' ,
36+ loc : { start : 2 , end : 7 } ,
37+ alias : null ,
38+ name :
39+ { kind : 'Name' ,
40+ loc : { start : 2 , end : 7 } ,
41+ value : 'field' } ,
42+ arguments : [ ] ,
43+ directives : [ ] ,
44+ selectionSet : null } ] } } ]
45+ } ) ;
46+ } ) ;
47+
1948 it ( 'parse provides useful errors' , ( ) => {
2049
2150 expect (
@@ -81,16 +110,7 @@ fragment MissingOn Type
81110 ) ;
82111
83112 it ( 'parses kitchen sink' , ( ) => {
84-
85- expect ( ( ) => {
86- try {
87- parse ( kitchenSink ) ;
88- } catch ( e ) {
89- console . log ( e . stack ) ;
90- throw e ;
91- }
92- } ) . to . not . throw ( ) ;
93-
113+ expect ( ( ) => parse ( kitchenSink ) ) . to . not . throw ( ) ;
94114 } ) ;
95115
96116 it ( 'parse creates ast' , ( ) => {
0 commit comments