@@ -78,7 +78,10 @@ test.serial('does not retry after cancelation', withServerAndFakeTimers, async (
78
78
gotPromise . cancel ( ) ;
79
79
} ) ;
80
80
81
- await t . throwsAsync ( gotPromise , { instanceOf : CancelError } ) ;
81
+ await t . throwsAsync ( gotPromise , {
82
+ instanceOf : CancelError ,
83
+ code : 'ERR_CANCELED'
84
+ } ) ;
82
85
await t . notThrowsAsync ( promise , 'Request finished instead of aborting.' ) ;
83
86
} ) ;
84
87
@@ -105,7 +108,10 @@ test.serial('cleans up request timeouts', withServer, async (t, server, got) =>
105
108
}
106
109
} ) ;
107
110
108
- await t . throwsAsync ( gotPromise , { instanceOf : CancelError } ) ;
111
+ await t . throwsAsync ( gotPromise , {
112
+ instanceOf : CancelError ,
113
+ code : 'ERR_CANCELED'
114
+ } ) ;
109
115
110
116
// Wait for unhandled errors
111
117
await delay ( 40 ) ;
@@ -127,7 +133,10 @@ test.serial('cancels in-progress request', withServerAndFakeTimers, async (t, se
127
133
body . push ( null ) ;
128
134
} ) ;
129
135
130
- await t . throwsAsync ( gotPromise , { instanceOf : CancelError } ) ;
136
+ await t . throwsAsync ( gotPromise , {
137
+ instanceOf : CancelError ,
138
+ code : 'ERR_CANCELED'
139
+ } ) ;
131
140
await t . notThrowsAsync ( promise , 'Request finished instead of aborting.' ) ;
132
141
} ) ;
133
142
@@ -147,7 +156,10 @@ test.serial('cancels in-progress request with timeout', withServerAndFakeTimers,
147
156
body . push ( null ) ;
148
157
} ) ;
149
158
150
- await t . throwsAsync ( gotPromise , { instanceOf : CancelError } ) ;
159
+ await t . throwsAsync ( gotPromise , {
160
+ instanceOf : CancelError ,
161
+ code : 'ERR_CANCELED'
162
+ } ) ;
151
163
await t . notThrowsAsync ( promise , 'Request finished instead of aborting.' ) ;
152
164
} ) ;
153
165
@@ -227,7 +239,10 @@ test.serial('throws on incomplete (canceled) response - promise #2', withServer,
227
239
promise . cancel ( ) ;
228
240
} , 500 ) ;
229
241
230
- await t . throwsAsync ( promise , { instanceOf : CancelError } ) ;
242
+ await t . throwsAsync ( promise , {
243
+ instanceOf : CancelError ,
244
+ code : 'ERR_CANCELED'
245
+ } ) ;
231
246
} ) ;
232
247
233
248
test . 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)
255
270
const promise = got ( { cache} ) ;
256
271
promise . cancel ( ) ;
257
272
258
- await t . throwsAsync ( promise , { instanceOf : CancelError } ) ;
273
+ await t . throwsAsync ( promise , {
274
+ instanceOf : CancelError ,
275
+ code : 'ERR_CANCELED'
276
+ } ) ;
259
277
} ) ;
0 commit comments