@empiricalrun/reporter
Advanced tools
Comparing version 0.21.3 to 0.21.4
# @empiricalrun/reporter | ||
## 0.21.4 | ||
### Patch Changes | ||
- 33c6c28: feat: add unique tests to playwright report summary | ||
## 0.21.3 | ||
@@ -4,0 +10,0 @@ |
export type Results = { | ||
hasPassed: boolean; | ||
totalTests: number; | ||
uniqueTests: number; | ||
flakyTests: number; | ||
@@ -5,0 +6,0 @@ skippedTests: number; |
@@ -0,1 +1,2 @@ | ||
import { JSONReport as PlaywrightJSONReport } from "@playwright/test/reporter"; | ||
import { BaseReportSource, FailedTestWithLink, Results } from "./base"; | ||
@@ -15,2 +16,3 @@ type PlaywrightReportFilter = { | ||
resultsSummary(): Results; | ||
uniqueTests(results: PlaywrightJSONReport): number; | ||
getTestIdForTestName(testName: string): string; | ||
@@ -17,0 +19,0 @@ hasRunFailed(): boolean; |
@@ -34,2 +34,3 @@ "use strict"; | ||
totalTests: results.stats.expected + results.stats.unexpected + results.stats.flaky, | ||
uniqueTests: this.uniqueTests(results), | ||
runDuration: results.stats.duration, | ||
@@ -44,2 +45,23 @@ runStartedAt: results.stats.startTime, | ||
} | ||
uniqueTests(results) { | ||
function buildSet(set, suite) { | ||
const { specs, suites } = suite; | ||
specs | ||
.filter(({ tests }) => tests && tests.some((t) => t.status != "skipped")) | ||
.forEach(({ file, line }) => { | ||
set.add(`${file}:${line}`); | ||
}); | ||
if (suites) { | ||
suites.forEach((suite) => { | ||
buildSet(set, suite); | ||
}); | ||
} | ||
} | ||
const fileAndLineNumbers = new Set(); | ||
const { suites } = results; | ||
suites.map((fileLevelSuite) => { | ||
buildSet(fileAndLineNumbers, fileLevelSuite); | ||
}); | ||
return fileAndLineNumbers.size; | ||
} | ||
getTestIdForTestName(testName) { | ||
@@ -46,0 +68,0 @@ const results = (0, utils_1.parseJsonReport)(this.srcFile); |
{ | ||
"name": "@empiricalrun/reporter", | ||
"version": "0.21.3", | ||
"version": "0.21.4", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "registry": "https://registry.npmjs.org/", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
51447
929