@@ -78,7 +78,10 @@ test.serial('does not retry after cancelation', withServerAndFakeTimers, async (
7878 gotPromise . cancel ( ) ;
7979 } ) ;
8080
81- await t . throwsAsync ( gotPromise , { instanceOf : CancelError } ) ;
81+ await t . throwsAsync ( gotPromise , {
82+ instanceOf : CancelError ,
83+ code : 'ERR_CANCELED'
84+ } ) ;
8285 await t . notThrowsAsync ( promise , 'Request finished instead of aborting.' ) ;
8386} ) ;
8487
@@ -105,7 +108,10 @@ test.serial('cleans up request timeouts', withServer, async (t, server, got) =>
105108 }
106109 } ) ;
107110
108- await t . throwsAsync ( gotPromise , { instanceOf : CancelError } ) ;
111+ await t . throwsAsync ( gotPromise , {
112+ instanceOf : CancelError ,
113+ code : 'ERR_CANCELED'
114+ } ) ;
109115
110116 // Wait for unhandled errors
111117 await delay ( 40 ) ;
@@ -127,7 +133,10 @@ test.serial('cancels in-progress request', withServerAndFakeTimers, async (t, se
127133 body . push ( null ) ;
128134 } ) ;
129135
130- await t . throwsAsync ( gotPromise , { instanceOf : CancelError } ) ;
136+ await t . throwsAsync ( gotPromise , {
137+ instanceOf : CancelError ,
138+ code : 'ERR_CANCELED'
139+ } ) ;
131140 await t . notThrowsAsync ( promise , 'Request finished instead of aborting.' ) ;
132141} ) ;
133142
@@ -147,7 +156,10 @@ test.serial('cancels in-progress request with timeout', withServerAndFakeTimers,
147156 body . push ( null ) ;
148157 } ) ;
149158
150- await t . throwsAsync ( gotPromise , { instanceOf : CancelError } ) ;
159+ await t . throwsAsync ( gotPromise , {
160+ instanceOf : CancelError ,
161+ code : 'ERR_CANCELED'
162+ } ) ;
151163 await t . notThrowsAsync ( promise , 'Request finished instead of aborting.' ) ;
152164} ) ;
153165
@@ -227,7 +239,10 @@ test.serial('throws on incomplete (canceled) response - promise #2', withServer,
227239 promise . cancel ( ) ;
228240 } , 500 ) ;
229241
230- await t . throwsAsync ( promise , { instanceOf : CancelError } ) ;
242+ await t . throwsAsync ( promise , {
243+ instanceOf : CancelError ,
244+ code : 'ERR_CANCELED'
245+ } ) ;
231246} ) ;
232247
233248test . serial ( 'throws on incomplete (canceled) response - stream' , withServerAndFakeTimers , async ( t , server , got , clock ) => {
@@ -255,5 +270,8 @@ test('throws when canceling cached request', withServer, async (t, server, got)
255270 const promise = got ( { cache} ) ;
256271 promise . cancel ( ) ;
257272
258- await t . throwsAsync ( promise , { instanceOf : CancelError } ) ;
273+ await t . throwsAsync ( promise , {
274+ instanceOf : CancelError ,
275+ code : 'ERR_CANCELED'
276+ } ) ;
259277} ) ;
0 commit comments