Skip to content

Commit

Permalink
Merge pull request #2 from ctrf-io/fix/duration-to-seconds
Browse files Browse the repository at this point in the history
Fix/duration to seconds
fixes #1
  • Loading branch information
Ma11hewThomas authored Oct 18, 2024
2 parents bbfd423 + 6e48f0b commit b661bcd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "teams-ctrf",
"version": "0.0.4",
"description": "",
"version": "0.0.5",
"description": "Send test results messages to Microsoft Teams",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down
6 changes: 4 additions & 2 deletions src/message-formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `&#x2705; ${passedTests} | &#x274C; ${failedTests} | &#x23E9; ${skippedTests} | &#x23F3; ${pendingTests} | &#x2753; ${otherTests}`;

Expand Down

0 comments on commit b661bcd

Please sign in to comment.