File tree 1 file changed +4
-1
lines changed
packages/node-integration-tests/utils
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import type { AxiosRequestConfig } from 'axios';
6
6
import axios from 'axios' ;
7
7
import type { Express } from 'express' ;
8
8
import type * as http from 'http' ;
9
+ import type { HttpTerminator } from 'http-terminator' ;
9
10
import { createHttpTerminator } from 'http-terminator' ;
10
11
import type { AddressInfo } from 'net' ;
11
12
import nock from 'nock' ;
@@ -125,10 +126,12 @@ async function makeRequest(
125
126
126
127
export class TestEnv {
127
128
private _axiosConfig : AxiosRequestConfig | undefined = undefined ;
129
+ private _terminator : HttpTerminator ;
128
130
129
131
public constructor ( public readonly server : http . Server , public readonly url : string ) {
130
132
this . server = server ;
131
133
this . url = url ;
134
+ this . _terminator = createHttpTerminator ( { server : this . server , gracefulTerminationTimeout : 0 } ) ;
132
135
133
136
// We need to destroy the socket after the response has been sent
134
137
// to prevent the server.close (called inside nock interceptor) from hanging in tests.
@@ -319,6 +322,6 @@ export class TestEnv {
319
322
}
320
323
321
324
private _closeServer ( ) : Promise < void > {
322
- return createHttpTerminator ( { server : this . server } ) . terminate ( ) ;
325
+ return this . _terminator . terminate ( ) ;
323
326
}
324
327
}
You can’t perform that action at this time.
0 commit comments