From fd392ab5b756b597d1110fb03567c93d3524cb7a Mon Sep 17 00:00:00 2001 From: Danyang Chen Date: Sun, 29 Nov 2026 13:25:55 +0800 Subject: [PATCH] Keep the Node 22 plugin tests alive while they await unref'd timers --- runtime/flybot-workspace-web/test/features.test.js | 10 +++++++++- .../flybot-workspace-web/test/memory-extras.test.js | 7 ++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/runtime/flybot-workspace-web/test/features.test.js b/runtime/flybot-workspace-web/test/features.test.js index 98451ccaa..c50f1dff4 100644 --- a/runtime/flybot-workspace-web/test/features.test.js +++ b/runtime/flybot-workspace-web/test/features.test.js @@ -155,7 +155,15 @@ test('duplicate and malformed endpoints are refused', () => { test('runtime() resolves once the DS-Bot wrapper attaches, and times out otherwise', async () => { detachRuntime() - await assert.rejects(runtime({ timeoutMs: 20 }), /not attached/) + // This assertion's rejection timer is unref'd, so on a host with nothing else + // holding the loop open the timer never fires and the test is cancelled + // instead of passing. Keep the loop alive until the rejection lands. + const keepAlive = setTimeout(() => {}, 1000) + try { + await assert.rejects(runtime({ timeoutMs: 20 }), /not attached/) + } finally { + clearTimeout(keepAlive) + } const pending = runtime({ timeoutMs: 1000 }) const rt = { bots: [] } const ctx = {} diff --git a/runtime/flybot-workspace-web/test/memory-extras.test.js b/runtime/flybot-workspace-web/test/memory-extras.test.js index afed86b1e..ccb33cfe0 100644 --- a/runtime/flybot-workspace-web/test/memory-extras.test.js +++ b/runtime/flybot-workspace-web/test/memory-extras.test.js @@ -394,7 +394,12 @@ test('automatic group capture has its own cursor and can be paused during extrac assert.deepEqual(await toggle(true),{enabled:true}) assert.deepEqual(await toggle(true),{enabled:true},'a retried enable preserves the cursor') assert.equal((await list()).body.group_capture,true) - await Promise.race([extracting,delay(6000,null,{ref:false}).then(()=>assert.fail('Group capture did not start'))]) + // Same shape as above: neither the capture scheduler nor the race timer + // holds the loop open, so keep it alive until the race settles. + const keepAlive = setTimeout(()=>{},6000) + try { + await Promise.race([extracting,delay(6000,null,{ref:false}).then(()=>assert.fail('Group capture did not start'))]) + } finally { clearTimeout(keepAlive) } assert.deepEqual(reads,[42]) await list('POST',{enabled:false}) assert.equal((await list()).body.queued,1,'the private-chat preference is independent')