From bdb612b6abe470b065110a940e48f4bbadeed3d8 Mon Sep 17 00:00:00 2001 From: Matthew Thomas Date: Fri, 18 Oct 2024 18:18:33 +0100 Subject: [PATCH] fix: duration in seconds --- src/message-formatter.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/message-formatter.ts b/src/message-formatter.ts index cea8be5..292eb97 100644 --- a/src/message-formatter.ts +++ b/src/message-formatter.ts @@ -41,8 +41,10 @@ export const formatResultsMessage = (ctrf: CtrfReport): object => { ? `${failedTests} failed tests` : `Passed`; - const duration = summary.stop - summary.start; - const durationText = `Duration: ${new Date(duration * 1000).toISOString().substr(11, 8)}`; + const durationInSeconds = (summary.stop - summary.start) / 1000; + const durationText = durationInSeconds < 1 + ? "*Duration:* <1s" + : `*Duration:* ${new Date(durationInSeconds * 1000).toISOString().substr(11, 8)}`; const testSummary = `✅ ${passedTests} | ❌ ${failedTests} | ⏩ ${skippedTests} | ⏳ ${pendingTests} | ❓ ${otherTests}`;