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 <floss4good@noreply.codeberg.org>
Reviewed-by: Beowulf <beowulf@beocode.eu>
Co-authored-by: oliverpool <git@olivier.pfad.fr>
Co-committed-by: oliverpool <git@olivier.pfad.fr>
This commit is contained in:
oliverpool 2025-06-25 15:58:55 +02:00 committed by Beowulf
parent 8844b6b8e5
commit 2bca029f6f

View file

@ -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);
}