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) {
9898}
9999
100100// 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.
104104export async function ignoreNetworkError < T extends RequestPromise | Promise < Response > > ( request : T , options : {
105105 context : Mocha . Context ,
106106 timeout ?: number
@@ -112,7 +112,7 @@ export async function ignoreNetworkError<T extends RequestPromise | Promise<Resp
112112 delay ( options . timeout ?? 1000 ) . then ( ( ) => { throw TimeoutError ; } )
113113 ] ) . catch ( error => {
114114 console . log ( error ) ;
115- if ( error === TimeoutError ) {
115+ if ( error === TimeoutError || error . name === 'FetchError' ) {
116116 console . warn ( `Skipping test due to network error: ${ error . message || error } ` ) ;
117117 if ( 'abort' in request ) request . abort ( ) ;
118118 throw options . context . skip ( ) ;
You can’t perform that action at this time.
0 commit comments