Skip to content

Commit 6fb386d

Browse files
committed
fix(tests): increase test fuzziness
These tests periodically fail in CI, 10 milliseconds is very much not enough time to account for fuzziness, and 5 minutes is more than enough precision given the scales of time involved in each test. PR-URL: #3201 Credit: @wraithgar Close: #3201 Reviewed-by: @nlf
1 parent 71ac935 commit 6fb386d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/lib/utils/update-notifier.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,15 @@ t.test('situations in which we do not notify', t => {
145145
})
146146

147147
t.test('only check weekly for GA releases', async t => {
148-
// the 10 is fuzz factor for test environment
149-
STAT_MTIME = Date.now() - (1000 * 60 * 60 * 24 * 7) + 10
148+
// One week (plus five minutes to account for test environment fuzziness)
149+
STAT_MTIME = Date.now() - (1000 * 60 * 60 * 24 * 7) + (1000 * 60 * 5)
150150
t.equal(await updateNotifier(npm), null)
151151
t.strictSame(MANIFEST_REQUEST, [], 'no requests for manifests')
152152
})
153153

154154
t.test('only check daily for betas', async t => {
155-
// the 10 is fuzz factor for test environment
156-
STAT_MTIME = Date.now() - (1000 * 60 * 60 * 24) + 10
155+
// One day (plus five minutes to account for test environment fuzziness)
156+
STAT_MTIME = Date.now() - (1000 * 60 * 60 * 24) + (1000 * 60 * 5)
157157
t.equal(await updateNotifier({ ...npm, version: HAVE_BETA }), null)
158158
t.strictSame(MANIFEST_REQUEST, [], 'no requests for manifests')
159159
})

0 commit comments

Comments
 (0)