From d88e25561c207d9db131027b260bb1ad3899d7b9 Mon Sep 17 00:00:00 2001 From: Alexis Campailla Date: Fri, 28 Feb 2014 19:46:22 +0100 Subject: [PATCH] test: fix test-timers-first-fire.js Making the test tolerant to rounding errors. --- test/simple/test-timers-first-fire.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/simple/test-timers-first-fire.js b/test/simple/test-timers-first-fire.js index e97b7ec8523..c4fa72e02b7 100644 --- a/test/simple/test-timers-first-fire.js +++ b/test/simple/test-timers-first-fire.js @@ -29,5 +29,6 @@ setTimeout(function() { var ms = (hr[0] * 1e3) + (hr[1] / 1e6); var delta = ms - TIMEOUT; console.log('timer fired in', delta); - assert.ok(delta > 0, 'Timer fired early'); + // Timer rounding to milliseconds can cause up to 1.5ms error + assert.ok(delta > -1.5, 'Timer fired early'); }, TIMEOUT);