Hold the event loop open while a save's timeout fires
AbortSignal.timeout's timer is unref'd. Node 24's test runner keeps the loop alive anyway, but Node 22's does not, so on hosted CI the file ended at this await and cancelled the twelve tests after it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+8
−1
fixtures/save-queue.test.mjs+8 −1
diff --git a/fixtures/save-queue.test.mjs b/fixtures/save-queue.test.mjs| index 3b49d94..39982e8 100644 |
| --- a/fixtures/save-queue.test.mjs |
| +++ b/fixtures/save-queue.test.mjs |
| @@ -260,7 +260,14 @@ test('a save is sent keepalive, and given up if it is never answered', async () |
| assert.equal(answerTimeoutMs(new Uint8Array(8)), SAVE_TIMEOUT_MS + 1 + 5000) |
| const { signal } = await saveRequest(new Uint8Array(1), { timeoutMs: 10 }) |
| assert.ok(signal, 'a save on the wire forever would stop every save after it') |
| - await new Promise((resolve) => signal.addEventListener('abort', resolve)) |
| + // AbortSignal.timeout's timer does not hold the event loop open. Node |
| + // 24's test runner keeps it open anyway; Node 22's does not, so with |
| + // nothing else pending it ends the file here and cancels every later |
| + // test. A held timer keeps the loop alive until the signal fires. |
| + await new Promise((resolve) => { |
| + const hold = setTimeout(() => {}, 60_000) |
| + signal.addEventListener('abort', () => { clearTimeout(hold); resolve() }) |
| + }) |
| assert.equal(signal.reason.name, 'TimeoutError') |
| }) |