test: clear node invoke connect timeout

This commit is contained in:
Shakker
2026-05-09 01:04:47 +01:00
parent 37611ef89a
commit c0bad2eda5

View File

@@ -275,12 +275,22 @@ describe("node.invoke approval bypass", () => {
},
});
client.start();
await Promise.race([
ready,
sleep(NODE_CONNECT_TIMEOUT_MS).then(() => {
throw new Error("timeout waiting for node to connect");
}),
]);
let timer: NodeJS.Timeout | undefined;
try {
await Promise.race([
ready,
new Promise<never>((_, reject) => {
timer = setTimeout(
() => reject(new Error("timeout waiting for node to connect")),
NODE_CONNECT_TIMEOUT_MS,
);
}),
]);
} finally {
if (timer) {
clearTimeout(timer);
}
}
return client;
};