Skip to content

Commit da2f3be

Browse files
Copilotfengmk2
andauthored
fix: close all proxy connections before closing server in test afterAll
In undici v8, ProxyAgent defaults proxyTunnel to true, which means CONNECT tunneling is used even for HTTP-to-HTTP proxy requests. These tunnel connections keep the proxy server alive, preventing proxyServer.close() from completing within the 10s afterAll timeout. Adding proxyServer.closeAllConnections() before proxyServer.close() forcefully terminates the tunnel connections and allows cleanup. Agent-Logs-Url: https://github.com/node-modules/urllib/sessions/4c3edcc4-7c2f-4451-b8f8-b324a333958d Co-authored-by: fengmk2 <156269+fengmk2@users.noreply.github.com>
1 parent 34e1186 commit da2f3be

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

test/options.dispatcher.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ describe('options.dispatcher.test.ts', () => {
2727

2828
afterAll(async () => {
2929
await close();
30+
proxyServer.closeAllConnections();
3031
await new Promise((resolve) => {
3132
proxyServer.close(resolve);
3233
});

0 commit comments

Comments
 (0)