Skip to content

Commit 44f8905

Browse files
committed
feat: always calculate metrics for insights and slowest tests reports
1 parent 6026fc0 commit 44f8905

File tree

6 files changed

+32
-4
lines changed

6 files changed

+32
-4
lines changed

badges/coverage.svg

Lines changed: 1 addition & 1 deletion
Loading

dist/index.js

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ctrf/metrics.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,13 @@ export async function processPreviousResultsAndMetrics(
326326

327327
let updatedReport = addPreviousReportsToCurrentReport(reports, report)
328328

329-
if (inputs.flakyRateReport || inputs.failRateReport || inputs.customReport) {
329+
if (
330+
inputs.flakyRateReport ||
331+
inputs.failRateReport ||
332+
inputs.insightsReport ||
333+
inputs.slowestReport ||
334+
inputs.customReport
335+
) {
330336
updatedReport = processTestReliabilityMetrics(
331337
updatedReport,
332338
reports,

src/ctrf/report-preparation.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ function shouldProcessPreviousResults(inputs: Inputs): boolean {
8989
inputs.previousResultsReport ||
9090
inputs.flakyRateReport ||
9191
inputs.failRateReport ||
92+
inputs.insightsReport ||
93+
inputs.slowestReport ||
9294
inputs.fetchPreviousResults
9395
)
9496
}

src/handlebars/helpers/ctrf.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ export function formatDurationStartStopToHumanHelper(): void {
127127
return 'not captured'
128128
}
129129

130+
if (isNaN(start) || isNaN(stop)) {
131+
return 'not captured'
132+
}
133+
130134
const durationMs = stop - start
131135
if (durationMs < 1) {
132136
return `1ms`
@@ -155,6 +159,10 @@ export function formatDurationStartStopToHumanHelper(): void {
155159
*/
156160
export function formatDurationMsToHumanHelper(): void {
157161
Handlebars.registerHelper('formatDurationMs', (duration: number) => {
162+
if (isNaN(duration)) {
163+
return 'not captured'
164+
}
165+
158166
if (duration < 1) {
159167
return `1ms`
160168
} else if (duration < 1000) {

0 commit comments

Comments
 (0)