fix(test/server): Fix force cleanup in DNS server tests by casting server properties before closing sockets

This commit is contained in:
2025-05-28 19:55:01 +00:00
parent 1185ea67d4
commit 0f8953fc1d
3 changed files with 11 additions and 5 deletions

View File

@ -193,13 +193,13 @@ async function stopServer(server: smartdns.DnsServer | null | undefined) {
try {
// @ts-ignore - accessing private properties for emergency cleanup
if (server.httpsServer) {
server.httpsServer.close();
server.httpsServer = null;
(server as any).httpsServer.close();
(server as any).httpsServer = null;
}
// @ts-ignore - accessing private properties for emergency cleanup
if (server.udpServer) {
server.udpServer.close();
server.udpServer = null;
(server as any).udpServer.close();
(server as any).udpServer = null;
}
} catch (forceError) {
console.log('Force cleanup error:', forceError.message || forceError);