diff --git a/src/views/ai.ts b/src/views/ai.ts index 938d7c6b..20b56ecd 100644 --- a/src/views/ai.ts +++ b/src/views/ai.ts @@ -21,8 +21,8 @@ export function generateAIFailedTestsSummaryTable(tests: CtrfTest[], useSuiteNam ]), ]) .addLink( - 'Github Actions Test Reporter CTRF', - 'https://github.com/ctrf-io/github-actions-test-reporter-ctrf' + 'Github Test Reporter CTRF', + 'https://github.com/ctrf-io/github-test-reporter' ) } else { core.summary.addRaw('No failed tests ✨') diff --git a/src/views/detailed.ts b/src/views/detailed.ts index 999ab820..b0c63d17 100644 --- a/src/views/detailed.ts +++ b/src/views/detailed.ts @@ -1,6 +1,6 @@ import * as core from '@actions/core' import { CtrfTest } from "../../types/ctrf" -import { getTestName } from "../common" +import { formatDurationHumanReadable, getTestName } from "../common" import { getEmojiForStatus } from "./common" export function generateTestDetailsTable(tests: CtrfTest[], useSuiteName: boolean): void { @@ -17,7 +17,7 @@ export function generateTestDetailsTable(tests: CtrfTest[], useSuiteName: boolea const headers = [ { data: 'Name', header: true }, { data: 'Status', header: true }, - { data: 'ms', header: true }, + { data: 'Duration', header: true }, { data: 'Flaky', header: true }, ] @@ -27,7 +27,7 @@ export function generateTestDetailsTable(tests: CtrfTest[], useSuiteName: boolea data: `${test.status} ${getEmojiForStatus(test.status)}`, header: false, }, - { data: test.duration.toString(), header: false }, + { data: formatDurationHumanReadable(test.duration), header: false }, { data: test.flaky ? '🍂' : '', header: false }, ]) @@ -39,8 +39,8 @@ export function generateTestDetailsTable(tests: CtrfTest[], useSuiteName: boolea ) } core.summary.addLink( - 'Github Actions Test Reporter CTRF', - 'https://github.com/ctrf-io/github-actions-test-reporter-ctrf' + 'Github Test Reporter CTRF', + 'https://github.com/ctrf-io/github-test-reporter' ) } catch (error) { if (error instanceof Error) { @@ -49,4 +49,8 @@ export function generateTestDetailsTable(tests: CtrfTest[], useSuiteName: boolea core.setFailed('An unknown error occurred') } } - } \ No newline at end of file + } + +function durationHumanReadabletest(duration: number): any { + throw new Error('Function not implemented.') +} diff --git a/src/views/failed-folded.ts b/src/views/failed-folded.ts index 1ffbc693..e87dea1f 100644 --- a/src/views/failed-folded.ts +++ b/src/views/failed-folded.ts @@ -42,7 +42,7 @@ export function generateFailedFoldedTable(tests: CtrfTest[], useSuiteName: boole core.summary.addRaw(tableHtml) core.summary.addLink( - 'Github Test Reporter', + 'Github Test Reporter CTRF', 'https://github.com/ctrf-io/github-test-reporter' ) } else { diff --git a/src/views/failed-rate.ts b/src/views/failed-rate.ts index 8648a873..4170bb3f 100644 --- a/src/views/failed-rate.ts +++ b/src/views/failed-rate.ts @@ -113,7 +113,7 @@ ${overallFailRateMessage} ${noFailMessage} -[Github Actions Test Reporter CTRF](https://github.com/ctrf-io/github-actions-test-reporter-ctrf) +[Github Test Reporter CTRF](https://github.com/ctrf-io/github-test-reporter) ` core.summary.addRaw(summary) return @@ -139,7 +139,7 @@ ${limitedSummaryRows.join('\n')} ${totalRunsMessage} -[Github Actions Test Reporter CTRF](https://github.com/ctrf-io/github-actions-test-reporter-ctrf) +[Github Test Reporter CTRF](https://github.com/ctrf-io/github-test-reporter) ` core.summary.addRaw(summaryTable) diff --git a/src/views/failed.ts b/src/views/failed.ts index f4f4bc87..cfe23e0c 100644 --- a/src/views/failed.ts +++ b/src/views/failed.ts @@ -34,8 +34,8 @@ export function generateFailedTestsDetailsTable(tests: CtrfTest[], useSuiteName: ` core.summary.addRaw(tableHtml) core.summary.addLink( - 'Github Actions Test Reporter CTRF', - 'https://github.com/ctrf-io/github-actions-test-reporter-ctrf' + 'Github Test Reporter CTRF', + 'https://github.com/ctrf-io/github-test-reporter' ) } else { core.summary.addRaw('
No failed tests ✨
') diff --git a/src/views/flaky-rate.ts b/src/views/flaky-rate.ts index 6c323a56..76b029aa 100644 --- a/src/views/flaky-rate.ts +++ b/src/views/flaky-rate.ts @@ -128,7 +128,7 @@ ${overallFlakeRateMessage} ${noFlakyMessage} -[Github Actions Test Reporter CTRF](https://github.com/ctrf-io/github-actions-test-reporter-ctrf) +[Github Test Reporter CTRF](https://github.com/ctrf-io/github-test-reporter) ` core.summary.addRaw(summary) return @@ -154,7 +154,7 @@ ${limitedSummaryRows.join('\n')} ${totalRunsMessage} -[Github Actions Test Reporter CTRF](https://github.com/ctrf-io/github-actions-test-reporter-ctrf) +[Github Test Reporter CTRF](https://github.com/ctrf-io/github-test-reporter-ctrf) ` core.summary.addRaw(summaryTable) } diff --git a/src/views/flaky.ts b/src/views/flaky.ts index a060fa81..0e2927f3 100644 --- a/src/views/flaky.ts +++ b/src/views/flaky.ts @@ -30,8 +30,8 @@ export function generateFlakyTestsDetailsTable(tests: CtrfTest[], useSuiteName: core.summary .addTable([headers, ...rows]) .addLink( - 'Github Actions Test Reporter CTRF', - 'https://github.com/ctrf-io/github-actions-test-reporter-ctrf' + 'Github Test Reporter CTRF', + 'https://github.com/ctrf-io/github-test-reporter' ) } else { core.summary.addRaw('No flaky tests detected. ✨') diff --git a/src/views/historical.ts b/src/views/historical.ts index 6ce07481..e08d3c96 100644 --- a/src/views/historical.ts +++ b/src/views/historical.ts @@ -1,6 +1,6 @@ import { type CtrfReport } from '../../types/ctrf' import * as core from '@actions/core' -import { extractGithubProperties } from '../common' +import { extractGithubProperties, formatDurationHumanReadable } from '../common' import { fetchArtifactsFromPreviousBuilds } from '../api/fetch-previous-runs' export async function generateHistoricSummary( @@ -45,12 +45,12 @@ export async function generateHistoricSummary( const summaryRows = workflowRun.map((run) => { const { results } = run const flakyCount = results.tests.filter((test) => test.flaky).length - const duration = results.summary.stop - results.summary.start - const durationFormatted = `${(duration / 1000).toFixed(2)} s` + const duration = report.results.summary.stop - report.results.summary.start + const durationHumanReadable = formatDurationHumanReadable(duration) const testResult = results.summary.failed > 0 ? 'Fail ❌' : 'Pass ✅' - return `| [#${run.runNumber}](${run.buildUrl}) | ${testResult} | ${results.summary.tests} | ${results.summary.passed} | ${results.summary.failed} | ${results.summary.skipped} | ${results.summary.pending} | ${results.summary.other} | ${flakyCount} | ${durationFormatted} |` + return `| [#${run.runNumber}](${run.buildUrl}) | ${testResult} | ${results.summary.tests} | ${results.summary.passed} | ${results.summary.failed} | ${results.summary.skipped} | ${results.summary.pending} | ${results.summary.other} | ${flakyCount} | ${durationHumanReadable} |` }) const limitedSummaryRows = summaryRows.slice(0, rows) @@ -60,7 +60,7 @@ export async function generateHistoricSummary( | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ${limitedSummaryRows.join('\n')} -[Github Actions Test Reporter CTRF](https://github.com/ctrf-io/github-actions-test-reporter-ctrf) +[Github Test Reporter CTRF](https://github.com/ctrf-io/github-test-reporter) ` core.summary.addHeading(`Previous Results`, 3) diff --git a/src/views/pull-request.ts b/src/views/pull-request.ts index d91d26f0..9365c7cf 100644 --- a/src/views/pull-request.ts +++ b/src/views/pull-request.ts @@ -1,5 +1,5 @@ import { CtrfReport } from "../../types/ctrf" -import { getTestName, stripAnsi } from "../common" +import { formatDurationHumanReadable, getTestName, stripAnsi } from "../common" import fs from 'fs' import https from 'https' @@ -9,12 +9,8 @@ export function generatePullRequestComment( title: string, useSuiteName: boolean ): string { - const durationInSeconds = - (report.results.summary.stop - report.results.summary.start) / 1000 - const durationFormatted = - durationInSeconds < 1 - ? '<1s' - : new Date(durationInSeconds * 1000).toISOString().substr(11, 8) + const duration = report.results.summary.stop - report.results.summary.start + const durationHumanReadable = formatDurationHumanReadable(duration) const runNumber = process.env.GITHUB_RUN_NUMBER @@ -67,12 +63,12 @@ export function generatePullRequestComment( | **Tests 📝** | **Passed ✅** | **Failed ❌** | **Skipped ⏭️** | **Pending ⏳** | **Other ❓** | **Flaky 🍂** | **Duration ⏱️** | | --- | --- | --- | --- | --- | --- | --- | --- | - | ${report.results.summary.tests} | ${report.results.summary.passed} | ${report.results.summary.failed} | ${report.results.summary.skipped} | ${report.results.summary.pending} | ${report.results.summary.other} | ${flakyCount} | ${durationFormatted} | + | ${report.results.summary.tests} | ${report.results.summary.passed} | ${report.results.summary.failed} | ${report.results.summary.skipped} | ${report.results.summary.pending} | ${report.results.summary.other} | ${flakyCount} | ${durationHumanReadable} | ### ${statusLine} ${failedTestsTable} - [Github Actions Test Reporter CTRF](https://github.com/ctrf-io/github-actions-test-reporter-ctrf) + [Github Test Reporter CTRF](https://github.com/ctrf-io/github-test-reporter) ` } diff --git a/src/views/skipped.ts b/src/views/skipped.ts index 983470df..56b75ae6 100644 --- a/src/views/skipped.ts +++ b/src/views/skipped.ts @@ -28,8 +28,8 @@ export function generateSkippedTestsDetailsTable(tests: CtrfTest[], useSuiteName core.summary .addTable([headers, ...rows]) .addLink( - 'Github Actions Test Reporter CTRF', - 'https://github.com/ctrf-io/github-actions-test-reporter-ctrf' + 'Github Test Reporter CTRF', + 'https://github.com/ctrf-io/github-test-reporter' ) } else { core.summary.addRaw('No skipped or pending tests detected. ✨') diff --git a/src/views/suite-folded.ts b/src/views/suite-folded.ts index f1869879..3aa69a53 100644 --- a/src/views/suite-folded.ts +++ b/src/views/suite-folded.ts @@ -5,15 +5,15 @@ import { formatDurationHumanReadable } from '../common' export function generateTestSuiteFoldedTable(tests: CtrfTest[], useSuite: boolean): void { try { core.summary.addHeading(`Test Suite Summary`, 3) - + const workspacePath = process.env.GITHUB_WORKSPACE || '' - + let totalPassed = 0 let totalFailed = 0 let totalSkippedPendingOther = { skipped: 0, pending: 0, other: 0 } const testResultsByGroup: Record