Skip to content

Commit

Permalink
Increase error margin on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperisager committed Feb 15, 2024
1 parent 1c1184b commit b0d3cf1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion test/helpers/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/* global Bare */

const nil = new Int32Array(new SharedArrayBuffer(4))

exports.isAround = function isAround (actual, expected, epsilon = 10) {
const isWindows = Bare.platform === 'win32'

exports.isAround = function isAround (actual, expected, epsilon = isWindows ? 50 : 25) {
return Math.abs(actual - expected) < epsilon
}

Expand Down
2 changes: 1 addition & 1 deletion test/timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test('setTimeout refresh', async function (t) {

const timer = timers.setTimeout(function () {
t.is(ticks, 6, 'was refreshed')
t.ok(isAround(Date.now() - started, 200), 'timers took ' + Math.abs(Date.now() - started) + 'ms')
t.ok(isAround(Date.now() - started, 200, 100), 'timers took ' + Math.abs(Date.now() - started) + 'ms')
}, 50)

let ticks = 0
Expand Down

0 comments on commit b0d3cf1

Please sign in to comment.