Skip to content

Commit 2b0b59c

Browse files
committed
Update http-terminator usage.
1 parent 87eb00f commit 2b0b59c

File tree

1 file changed

+4
-1
lines changed
  • packages/node-integration-tests/utils

1 file changed

+4
-1
lines changed

packages/node-integration-tests/utils/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type { AxiosRequestConfig } from 'axios';
66
import axios from 'axios';
77
import type { Express } from 'express';
88
import type * as http from 'http';
9+
import type { HttpTerminator } from 'http-terminator';
910
import { createHttpTerminator } from 'http-terminator';
1011
import type { AddressInfo } from 'net';
1112
import nock from 'nock';
@@ -125,10 +126,12 @@ async function makeRequest(
125126

126127
export class TestEnv {
127128
private _axiosConfig: AxiosRequestConfig | undefined = undefined;
129+
private _terminator: HttpTerminator;
128130

129131
public constructor(public readonly server: http.Server, public readonly url: string) {
130132
this.server = server;
131133
this.url = url;
134+
this._terminator = createHttpTerminator({ server: this.server, gracefulTerminationTimeout: 0 });
132135

133136
// We need to destroy the socket after the response has been sent
134137
// to prevent the server.close (called inside nock interceptor) from hanging in tests.
@@ -319,6 +322,6 @@ export class TestEnv {
319322
}
320323

321324
private _closeServer(): Promise<void> {
322-
return createHttpTerminator({ server: this.server }).terminate();
325+
return this._terminator.terminate();
323326
}
324327
}

0 commit comments

Comments
 (0)