From 9416ee49b28b311dcf9fad25b0ed3972ca9a6301 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Fri, 26 Apr 2024 21:08:40 -0700 Subject: [PATCH] windows: patch setTimeout.test.js flakiness (#10564) --- test/js/web/timers/setTimeout.test.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/js/web/timers/setTimeout.test.js b/test/js/web/timers/setTimeout.test.js index 403cd82ce20461..0e3ba0078d1e73 100644 --- a/test/js/web/timers/setTimeout.test.js +++ b/test/js/web/timers/setTimeout.test.js @@ -1,10 +1,8 @@ import { spawnSync } from "bun"; import { it, expect } from "bun:test"; -import { bunEnv, bunExe } from "harness"; +import { bunEnv, bunExe, isWindows } from "harness"; import path from "node:path"; -const isWindows = process.platform === "win32"; - it("setTimeout", async () => { var lastID = -1; const result = await new Promise((resolve, reject) => { @@ -255,8 +253,11 @@ it("setTimeout should refresh N times", done => { setTimeout(() => { clearTimeout(timer); - expect(count).toBeGreaterThanOrEqual(5); - done(); + try { + expect(count).toBeGreaterThanOrEqual(isWindows ? 4 : 5); + } finally { + done(); + } }, 300); });