From c9a944e3cad5987b2d8821f9c817d4a500c21d2b Mon Sep 17 00:00:00 2001 From: Jakob Getz Date: Tue, 6 Feb 2024 17:13:39 +0900 Subject: [PATCH] dont fail because of avg round trip times --- tests/run-tests.cts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/run-tests.cts b/tests/run-tests.cts index ee715d8a..e58769cc 100644 --- a/tests/run-tests.cts +++ b/tests/run-tests.cts @@ -146,7 +146,10 @@ async function runNodeTest(name: string, options): Promise { function writeSummary(type: string, testCount: number, successfull: number, roundTripTimes: DOMHighResTimeStamp[]) { const fail = testCount - successfull - const avgRoundTripTime = roundTripTimes.reduce((p, c) => p + c) / roundTripTimes.length + let avgRoundTripTime = undefined + if (roundTripTimes.length > 0) { + avgRoundTripTime = roundTripTimes.reduce((p, c) => p + c) / roundTripTimes.length + } console.log(`finished running ${testCount} ${type} testcases. Pass: ${successfull}, Fail: ${fail}, FailRate: ${fail / testCount * 100}%, Avg time: ${avgRoundTripTime}`); } @@ -231,7 +234,7 @@ async function runOnlineTests(names: string[], options) { cleanUpPerformance() await writeReport(name, report) if (report.success === true) { - successfull++ + successfull++ } if (report.roundTripTime !== undefined) { roundTripTimes.push(report.roundTripTime)