From 9eaef5dfdf457fff0f530a9e71abd4aabf43e3a2 Mon Sep 17 00:00:00 2001 From: Dominic Griesel Date: Wed, 6 Nov 2024 21:32:56 +0100 Subject: [PATCH] fix: flaky tests --- packages/zwave-js/src/lib/driver/Task.test.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/zwave-js/src/lib/driver/Task.test.ts b/packages/zwave-js/src/lib/driver/Task.test.ts index 5d1a38031c07..41a58922cc70 100644 --- a/packages/zwave-js/src/lib/driver/Task.test.ts +++ b/packages/zwave-js/src/lib/driver/Task.test.ts @@ -1069,13 +1069,9 @@ test("Tasks can be removed while paused, part 2", async (t) => { const order: string[] = []; scheduler.start(); - const t1WasStarted = createDeferredPromise(); - const t2WasStarted = createDeferredPromise(); - const task1 = scheduler.queueTask({ priority: TaskPriority.Normal, task: async function*() { - t1WasStarted.resolve(); order.push("1a"); yield () => wait(10); order.push("1b"); @@ -1091,7 +1087,6 @@ test("Tasks can be removed while paused, part 2", async (t) => { name: "task2", priority: TaskPriority.Normal, task: async function*() { - t2WasStarted.resolve(); order.push("2a"); yield () => wait(10); order.push("2b"); @@ -1103,7 +1098,7 @@ test("Tasks can be removed while paused, part 2", async (t) => { }, }); - await Promise.all([t1WasStarted, t2WasStarted]); + await wait(5); // The tasks have run to the first yield t.expect(order).toStrictEqual(["1a", "2a"]);