From 66a2cb210a6b95a5b09b459edd85b1220137105a Mon Sep 17 00:00:00 2001 From: jakecastelli <38635403+jakecastelli@users.noreply.github.com> Date: Fri, 27 Sep 2024 15:46:20 +0930 Subject: [PATCH] test: deflake test/pummel/test-timers.js PR-URL: https://github.com/nodejs/node/pull/55098 Fixes: https://github.com/nodejs/node/issues/55092 Reviewed-By: Luigi Pinca Reviewed-By: Antoine du Hamel --- test/pummel/test-timers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/pummel/test-timers.js b/test/pummel/test-timers.js index 2f5580840231e3..74d9f4eb41e684 100644 --- a/test/pummel/test-timers.js +++ b/test/pummel/test-timers.js @@ -36,7 +36,7 @@ const WINDOW = 200; // Why does this need to be so big? assert.ok(diff > 0); console.error(`diff: ${diff}`); - assert.ok(1000 <= diff && diff < 1000 + WINDOW); + assert.ok(Math.abs(diff - 1000) < WINDOW); }), 1000); } @@ -61,7 +61,7 @@ const WINDOW = 200; // Why does this need to be so big? const t = interval_count * 1000; - assert.ok(t <= diff && diff < t + (WINDOW * interval_count)); + assert.ok(Math.abs(diff - t) < WINDOW * interval_count); assert.ok(interval_count <= 3, `interval_count: ${interval_count}`); if (interval_count === 3)