@@ -246,15 +246,18 @@ describe('Execute: Handles basic execution tasks', () => {
246246
247247 it ( 'nulls out error subtrees' , async ( ) => {
248248 var doc = `{
249- sync,
250- syncError,
251- syncRawError,
252- async,
253- asyncReject,
254- asyncRawReject,
255- asyncEmptyReject,
256- asyncError,
249+ sync
250+ syncError
251+ syncRawError
252+ syncReturnError
253+ syncReturnErrorList
254+ async
255+ asyncReject
256+ asyncRawReject
257+ asyncEmptyReject
258+ asyncError
257259 asyncRawError
260+ asyncReturnError
258261 }` ;
259262
260263 var data = {
@@ -269,6 +272,17 @@ describe('Execute: Handles basic execution tasks', () => {
269272 throw 'Error getting syncRawError' ;
270273 /* eslint-enable */
271274 } ,
275+ syncReturnError ( ) {
276+ return new Error ( 'Error getting syncReturnError' ) ;
277+ } ,
278+ syncReturnErrorList ( ) {
279+ return [
280+ 'sync0' ,
281+ new Error ( 'Error getting syncReturnErrorList1' ) ,
282+ 'sync2' ,
283+ new Error ( 'Error getting syncReturnErrorList3' )
284+ ] ;
285+ } ,
272286 async ( ) {
273287 return new Promise ( resolve => resolve ( 'async' ) ) ;
274288 } ,
@@ -294,7 +308,10 @@ describe('Execute: Handles basic execution tasks', () => {
294308 throw 'Error getting asyncRawError' ;
295309 /* eslint-enable */
296310 } ) ;
297- }
311+ } ,
312+ asyncReturnError ( ) {
313+ return Promise . resolve ( new Error ( 'Error getting asyncReturnError' ) ) ;
314+ } ,
298315 } ;
299316
300317 let ast = parse ( doc ) ;
@@ -305,12 +322,15 @@ describe('Execute: Handles basic execution tasks', () => {
305322 sync : { type : GraphQLString } ,
306323 syncError : { type : GraphQLString } ,
307324 syncRawError : { type : GraphQLString } ,
325+ syncReturnError : { type : GraphQLString } ,
326+ syncReturnErrorList : { type : new GraphQLList ( GraphQLString ) } ,
308327 async : { type : GraphQLString } ,
309328 asyncReject : { type : GraphQLString } ,
310329 asyncRawReject : { type : GraphQLString } ,
311330 asyncEmptyReject : { type : GraphQLString } ,
312331 asyncError : { type : GraphQLString } ,
313332 asyncRawError : { type : GraphQLString } ,
333+ asyncReturnError : { type : GraphQLString } ,
314334 }
315335 } )
316336 } ) ;
@@ -321,29 +341,40 @@ describe('Execute: Handles basic execution tasks', () => {
321341 sync : 'sync' ,
322342 syncError : null ,
323343 syncRawError : null ,
344+ syncReturnError : null ,
345+ syncReturnErrorList : [ 'sync0' , null , 'sync2' , null ] ,
324346 async : 'async' ,
325347 asyncReject : null ,
326348 asyncRawReject : null ,
327349 asyncEmptyReject : null ,
328350 asyncError : null ,
329351 asyncRawError : null ,
352+ asyncReturnError : null ,
330353 } ) ;
331354
332355 expect ( result . errors && result . errors . map ( formatError ) ) . to . deep . equal ( [
333356 { message : 'Error getting syncError' ,
334357 locations : [ { line : 3 , column : 7 } ] } ,
335358 { message : 'Error getting syncRawError' ,
336359 locations : [ { line : 4 , column : 7 } ] } ,
337- { message : 'Error getting asyncReject' ,
360+ { message : 'Error getting syncReturnError' ,
361+ locations : [ { line : 5 , column : 7 } ] } ,
362+ { message : 'Error getting syncReturnErrorList1' ,
363+ locations : [ { line : 6 , column : 7 } ] } ,
364+ { message : 'Error getting syncReturnErrorList3' ,
338365 locations : [ { line : 6 , column : 7 } ] } ,
366+ { message : 'Error getting asyncReturnError' ,
367+ locations : [ { line : 13 , column : 7 } ] } ,
368+ { message : 'Error getting asyncReject' ,
369+ locations : [ { line : 8 , column : 7 } ] } ,
339370 { message : 'Error getting asyncRawReject' ,
340- locations : [ { line : 7 , column : 7 } ] } ,
371+ locations : [ { line : 9 , column : 7 } ] } ,
341372 { message : 'An unknown error occurred.' ,
342- locations : [ { line : 8 , column : 7 } ] } ,
373+ locations : [ { line : 10 , column : 7 } ] } ,
343374 { message : 'Error getting asyncError' ,
344- locations : [ { line : 9 , column : 7 } ] } ,
375+ locations : [ { line : 11 , column : 7 } ] } ,
345376 { message : 'Error getting asyncRawError' ,
346- locations : [ { line : 10 , column : 7 } ] } ,
377+ locations : [ { line : 12 , column : 7 } ] } ,
347378 ] ) ;
348379 } ) ;
349380
0 commit comments