File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed
Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,19 @@ jest.setTimeout(+(process.env.BUGSNAG_TIMEOUT_MS as string) * 10)
1111let server : http . Server
1212afterEach ( ( ) => server ?. close ( ) )
1313
14+ const originalSetTimeout = http . ClientRequest . prototype . setTimeout ;
15+
16+ beforeAll ( ( ) => {
17+ // trigger a timeout without waiting much real time
18+ http . ClientRequest . prototype . setTimeout = function ( _timeout : number , cb ?: ( ) => void ) {
19+ return originalSetTimeout . call ( this , 100 , cb )
20+ }
21+ } )
22+
23+ afterAll ( ( ) => {
24+ http . ClientRequest . prototype . setTimeout = originalSetTimeout
25+ } )
26+
1427test ( 'request: isRetryable()' , ( ) => {
1528 expect ( isRetryable ( undefined ) ) . toBe ( true )
1629 expect ( isRetryable ( 100 ) ) . toBe ( true )
@@ -508,17 +521,4 @@ test('request: fetch() unsuccessful (timeout)', async () => {
508521 expect ( e . code ) . toBe ( NetworkErrorCode . TIMEOUT )
509522 }
510523
511- } )
512-
513- const originalSetTimeout = http . ClientRequest . prototype . setTimeout ;
514-
515- beforeAll ( ( ) => {
516- // trigger a timeout without waiting much real time
517- http . ClientRequest . prototype . setTimeout = function ( _timeout : number , cb ?: ( ) => void ) {
518- return originalSetTimeout . call ( this , 100 , cb )
519- }
520- } )
521-
522- afterAll ( ( ) => {
523- http . ClientRequest . prototype . setTimeout = originalSetTimeout
524524} )
You can’t perform that action at this time.
0 commit comments