From 2bca029f6fe0812c2c1b6741a9e8a4ae75e8c0a0 Mon Sep 17 00:00:00 2001 From: oliverpool Date: Wed, 25 Jun 2025 15:58:55 +0200 Subject: [PATCH] chore(ci): testSleep: show actual times on failures (#8271) I just experienced a spurious error on `testSleep`. The current assertion only showed `expected false to be truthy`. With this PR it should show the actual elapsed time (to be able to knowingly adjust the expected delay). Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8271 Reviewed-by: floss4good Reviewed-by: Beowulf Co-authored-by: oliverpool Co-committed-by: oliverpool --- web_src/js/utils.test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web_src/js/utils.test.js b/web_src/js/utils.test.js index 535aae874a..365eb63e30 100644 --- a/web_src/js/utils.test.js +++ b/web_src/js/utils.test.js @@ -1,3 +1,4 @@ +import {expect, test} from 'vitest'; import { basename, extname, isObject, stripTags, parseIssueHref, parseUrl, translateMonth, translateDay, blobToDataURI, @@ -182,5 +183,5 @@ async function testSleep(ms) { await sleep(ms); const endTime = Date.now(); // Record the end time const actualSleepTime = endTime - startTime; - expect(actualSleepTime >= ms).toBeTruthy(); + expect(actualSleepTime).toBeGreaterThanOrEqual(ms); }