1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-06 18:35:23 +02:00

[v12.0/forgejo] chore(ci): testSleep: show actual times on failures (#8277)

**Backport:** https://codeberg.org/forgejo/forgejo/pulls/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).

Co-authored-by: oliverpool <git@olivier.pfad.fr>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8277
Reviewed-by: Beowulf <beowulf@beocode.eu>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
This commit is contained in:
forgejo-backport-action 2025-06-25 16:43:06 +02:00 committed by Beowulf
parent 6d4554b01c
commit 309ddf6ec7

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