Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGar <gar+gh@danger.computer>2021-05-07 00:17:41 +0300
committerGar <gar+gh@danger.computer>2021-05-07 21:56:34 +0300
commit6fb386d3bfbaa8e4771ff87a08de1f3aa6f9b34d (patch)
treee11ef65b948333203ddad5395627836ffed53293
parent71ac935976390e4fd05987ff510049f82bc6e2a9 (diff)
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: https://github.com/npm/cli/pull/3201 Credit: @wraithgar Close: #3201 Reviewed-by: @nlf
-rw-r--r--test/lib/utils/update-notifier.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/lib/utils/update-notifier.js b/test/lib/utils/update-notifier.js
index 1735b3105..ad4d40772 100644
--- a/test/lib/utils/update-notifier.js
+++ b/test/lib/utils/update-notifier.js
@@ -145,15 +145,15 @@ t.test('situations in which we do not notify', t => {
})
t.test('only check weekly for GA releases', async t => {
- // the 10 is fuzz factor for test environment
- STAT_MTIME = Date.now() - (1000 * 60 * 60 * 24 * 7) + 10
+ // One week (plus five minutes to account for test environment fuzziness)
+ STAT_MTIME = Date.now() - (1000 * 60 * 60 * 24 * 7) + (1000 * 60 * 5)
t.equal(await updateNotifier(npm), null)
t.strictSame(MANIFEST_REQUEST, [], 'no requests for manifests')
})
t.test('only check daily for betas', async t => {
- // the 10 is fuzz factor for test environment
- STAT_MTIME = Date.now() - (1000 * 60 * 60 * 24) + 10
+ // One day (plus five minutes to account for test environment fuzziness)
+ STAT_MTIME = Date.now() - (1000 * 60 * 60 * 24) + (1000 * 60 * 5)
t.equal(await updateNotifier({ ...npm, version: HAVE_BETA }), null)
t.strictSame(MANIFEST_REQUEST, [], 'no requests for manifests')
})