File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -98,9 +98,9 @@ export function nodeOnly(body: Function) {
98
98
}
99
99
100
100
// Wrap a test promise that might fail due to irrelevant remote network issues, and it'll skip the test
101
- // if there's a timeout or 502 response (but still throw any other errors). This allows us to write tests
102
- // that will fail if a remote server explicitly rejects something, but make them resilient to the remote
103
- // server simply being entirely unavailable.
101
+ // if there's a timeout, connection error or 502 response (but still throw any other errors). This allows
102
+ // us to write tests that will fail if a remote server explicitly rejects something, but make them
103
+ // resilient to the remote server simply being entirely unavailable.
104
104
export async function ignoreNetworkError < T extends RequestPromise | Promise < Response > > ( request : T , options : {
105
105
context : Mocha . Context ,
106
106
timeout ?: number
@@ -112,7 +112,7 @@ export async function ignoreNetworkError<T extends RequestPromise | Promise<Resp
112
112
delay ( options . timeout ?? 1000 ) . then ( ( ) => { throw TimeoutError ; } )
113
113
] ) . catch ( error => {
114
114
console . log ( error ) ;
115
- if ( error === TimeoutError ) {
115
+ if ( error === TimeoutError || error . name === 'FetchError' ) {
116
116
console . warn ( `Skipping test due to network error: ${ error . message || error } ` ) ;
117
117
if ( 'abort' in request ) request . abort ( ) ;
118
118
throw options . context . skip ( ) ;
You can’t perform that action at this time.
0 commit comments