@@ -61,7 +61,7 @@ const schema = buildSchema(`
6161` ) ;
6262
6363describe ( 'Execute: Cancellation' , ( ) => {
64- it ( 'should stop the execution when aborted' , async ( ) => {
64+ it ( 'should stop the execution when aborted during object field completion ' , async ( ) => {
6565 const abortController = new AbortController ( ) ;
6666 const document = parse ( `
6767 query {
@@ -89,7 +89,7 @@ describe('Execute: Cancellation', () => {
8989 } ,
9090 } ) ;
9191
92- abortController . abort ( 'Aborted' ) ;
92+ abortController . abort ( new Error ( 'Aborted' ) ) ;
9393
9494 const result = await resultPromise ;
9595
@@ -100,8 +100,8 @@ describe('Execute: Cancellation', () => {
100100 errors : [
101101 {
102102 message : 'Aborted' ,
103- path : [ 'todo' ] ,
104- locations : [ { line : 3 , column : 9 } ] ,
103+ path : [ 'todo' , 'id' ] ,
104+ locations : [ { line : 4 , column : 11 } ] ,
105105 } ,
106106 ] ,
107107 } ) ;
@@ -135,7 +135,7 @@ describe('Execute: Cancellation', () => {
135135 } ,
136136 } ) ;
137137
138- abortController . abort ( 'Aborted' ) ;
138+ abortController . abort ( new Error ( 'Aborted' ) ) ;
139139
140140 const result = await resultPromise ;
141141
@@ -149,8 +149,8 @@ describe('Execute: Cancellation', () => {
149149 errors : [
150150 {
151151 message : 'Aborted' ,
152- path : [ 'todo' , 'author' ] ,
153- locations : [ { line : 5 , column : 11 } ] ,
152+ path : [ 'todo' , 'author' , 'id' ] ,
153+ locations : [ { line : 6 , column : 13 } ] ,
154154 } ,
155155 ] ,
156156 } ) ;
@@ -165,9 +165,7 @@ describe('Execute: Cancellation', () => {
165165 ... on Todo @defer {
166166 text
167167 author {
168- ... on Author @defer {
169- id
170- }
168+ id
171169 }
172170 }
173171 }
@@ -189,7 +187,7 @@ describe('Execute: Cancellation', () => {
189187 abortSignal : abortController . signal ,
190188 } ) ;
191189
192- abortController . abort ( 'Aborted' ) ;
190+ abortController . abort ( new Error ( 'Aborted' ) ) ;
193191
194192 const result = await resultPromise ;
195193
@@ -200,8 +198,8 @@ describe('Execute: Cancellation', () => {
200198 errors : [
201199 {
202200 message : 'Aborted' ,
203- path : [ 'todo' ] ,
204- locations : [ { line : 3 , column : 9 } ] ,
201+ path : [ 'todo' , 'id' ] ,
202+ locations : [ { line : 4 , column : 11 } ] ,
205203 } ,
206204 ] ,
207205 } ) ;
@@ -216,9 +214,7 @@ describe('Execute: Cancellation', () => {
216214 ... on Todo @defer {
217215 text
218216 author {
219- ... on Author @defer {
220- id
221- }
217+ id
222218 }
223219 }
224220 }
@@ -232,9 +228,8 @@ describe('Execute: Cancellation', () => {
232228 Promise . resolve ( {
233229 id : '1' ,
234230 text : 'hello world' ,
235- /* c8 ignore next 2 */
236- author : async ( ) =>
237- Promise . resolve ( ( ) => expect . fail ( 'Should not be called' ) ) ,
231+ /* c8 ignore next */
232+ author : ( ) => expect . fail ( 'Should not be called' ) ,
238233 } ) ,
239234 } ,
240235 abortController . signal ,
@@ -244,7 +239,7 @@ describe('Execute: Cancellation', () => {
244239 await resolveOnNextTick ( ) ;
245240 await resolveOnNextTick ( ) ;
246241
247- abortController . abort ( 'Aborted' ) ;
242+ abortController . abort ( new Error ( 'Aborted' ) ) ;
248243
249244 const result = await resultPromise ;
250245
@@ -264,6 +259,8 @@ describe('Execute: Cancellation', () => {
264259 errors : [
265260 {
266261 message : 'Aborted' ,
262+ path : [ 'todo' , 'text' ] ,
263+ locations : [ { line : 6 , column : 13 } ] ,
267264 } ,
268265 ] ,
269266 id : '0' ,
@@ -294,7 +291,7 @@ describe('Execute: Cancellation', () => {
294291 } ,
295292 } ) ;
296293
297- abortController . abort ( 'Aborted' ) ;
294+ abortController . abort ( new Error ( 'Aborted' ) ) ;
298295
299296 const result = await resultPromise ;
300297
@@ -325,7 +322,9 @@ describe('Execute: Cancellation', () => {
325322 }
326323 }
327324 ` ) ;
328- abortController . abort ( 'Aborted' ) ;
325+
326+ abortController . abort ( new Error ( 'Aborted' ) ) ;
327+
329328 const result = await execute ( {
330329 document,
331330 schema,
0 commit comments