Fix npm test exit 1 — uncaught ECONNRESET from fake-bridge sockets without error handlers (v0.21.8)
CI / build + unit (pull_request) Successful in 46s
CI / build + unit (pull_request) Successful in 46s
This commit is contained in:
@@ -10,6 +10,8 @@ export function startBridge(
|
||||
): Promise<{ port: number; sockets: net.Socket[]; close: () => void }> {
|
||||
const sockets: net.Socket[] = [];
|
||||
const server = net.createServer((socket) => {
|
||||
// Test-owned socket: the service destroys its end mid-test with unread data pending (overflow/garbage tests), which makes the kernel send RST and this side emit ECONNRESET. Expected teardown noise — without a handler Node throws it as an uncaught exception and vitest fails the whole run.
|
||||
socket.on('error', () => {});
|
||||
onSocket?.(socket); // attached at accept time, before any data can arrive
|
||||
sockets.push(socket);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user