From 88595b541c6ab3e1a2df9cede48e76350ef8249d Mon Sep 17 00:00:00 2001 From: can1357 Date: Wed, 8 Apr 2026 12:29:12 +0200 Subject: [PATCH] fix(test): use setImmediate drain instead of sleep for history insert timing --- .../coding-agent/test/history-storage-sqlite-compat.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/coding-agent/test/history-storage-sqlite-compat.test.ts b/packages/coding-agent/test/history-storage-sqlite-compat.test.ts index 1c6bdd930..3e2f7555f 100644 --- a/packages/coding-agent/test/history-storage-sqlite-compat.test.ts +++ b/packages/coding-agent/test/history-storage-sqlite-compat.test.ts @@ -47,7 +47,8 @@ it("migrates legacy history schema away from unixepoch defaults", async () => { const storage = HistoryStorage.open(dbPath); storage.add("new prompt", "/tmp/new"); - await Bun.sleep(100); + // add() defers the INSERT via setImmediate; drain the macrotask queue + await new Promise(resolve => setImmediate(resolve)); const db = new Database(dbPath, { readonly: true }); try {