From 0c7c7419886ba1879564e20eaaf44ffbf01ffc75 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Tue, 3 Nov 2026 07:29:13 +0000 Subject: [PATCH] fix(chord): channel test attaches its expectation before the deadline can pass --- packages/chord/test/link/channel.test.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/chord/test/link/channel.test.ts b/packages/chord/test/link/channel.test.ts index 5e974720f..dee0e3e72 100644 --- a/packages/chord/test/link/channel.test.ts +++ b/packages/chord/test/link/channel.test.ts @@ -95,10 +95,13 @@ forEachCodec(() => const [a, b] = memoryLinkPair(); client.connect(a, { principal: { kind: "server" }, codec: testCodec() }, context); const peer = new RawPeer(b, { hello: false }); - const got = client.get(Thing, {}, context, { readyTimeout: 20 }); + // The expectation is attached at once: on a slow machine the 20 ms pass before `flushed` returns. + const failed = expect(client.get(Thing, {}, context, { readyTimeout: 20 })).rejects.toThrow( + "app.thing: did not become live within 20 ms", + ); await flushed(); expect(peer.kinds()).toEqual(["hello"]); - await expect(got).rejects.toThrow("app.thing: did not become live within 20 ms"); + await failed; peer.send({ kind: "hello", protocol: PROTOCOL_VERSION, incarnation: RAW_PEER, calls: 256 }); await transported(); expect(peer.kinds()).toEqual(["hello", "hold", "release"]);