@empiricalrun/reporter
Advanced tools
Comparing version 0.9.1 to 0.9.2
# @empiricalrun/reporter | ||
## 0.9.2 | ||
### Patch Changes | ||
- b45527e: feat: add browser name to failed tests if suite has cross-browser | ||
## 0.9.1 | ||
@@ -4,0 +10,0 @@ |
@@ -10,4 +10,4 @@ import { BaseReportSource, FailedTestWithLink, Platform, Results } from "./base"; | ||
private runId; | ||
srcFile: string; | ||
constructor(projectName: string, runId: string); | ||
private srcFile; | ||
constructor(projectName: string, runId: string, srcFile?: string); | ||
platform(): Platform; | ||
@@ -20,4 +20,5 @@ getSummaryReportUrl(): string; | ||
private failedTestsFromSuite; | ||
private hasCrossBrowserTests; | ||
} | ||
export {}; | ||
//# sourceMappingURL=playwright.d.ts.map |
@@ -12,9 +12,11 @@ "use strict"; | ||
const base_1 = require("./base"); | ||
const defaultLocation = path_1.default.join(process.cwd(), "test-results", "summary.json"); | ||
class PlaywrightReportSource { | ||
projectName; | ||
runId; | ||
srcFile = path_1.default.join(process.cwd(), "test-results", "summary.json"); | ||
constructor(projectName, runId) { | ||
srcFile; | ||
constructor(projectName, runId, srcFile = defaultLocation) { | ||
this.projectName = projectName; | ||
this.runId = runId; | ||
this.srcFile = srcFile; | ||
} | ||
@@ -59,4 +61,11 @@ platform() { | ||
}); | ||
return failedSpecs.map(({ title, id }) => { | ||
return { name: title, link: this.reportLink({ testId: id }) }; | ||
return failedSpecs.map(({ title, id, tests }) => { | ||
let projectNamePrefix = ""; | ||
if (this.hasCrossBrowserTests() && tests && tests.length > 0) { | ||
projectNamePrefix = `[${tests[0].projectName}] `; | ||
} | ||
return { | ||
name: `${projectNamePrefix}${title}`, | ||
link: this.reportLink({ testId: id }), | ||
}; | ||
}); | ||
@@ -91,3 +100,23 @@ } | ||
} | ||
hasCrossBrowserTests() { | ||
const results = (0, utils_1.parseJsonReport)(this.srcFile); | ||
const { config } = results; | ||
// If there are multiple projects that have the same testDir, testMatch, testIgnore | ||
const projects = config.projects.map(({ name, testDir, testIgnore, testMatch }) => { | ||
const paths = { | ||
testDir, | ||
testMatch, | ||
testIgnore, | ||
}; | ||
return { name, hash: btoa(JSON.stringify(paths)) }; | ||
}); | ||
let commonHashes = []; | ||
projects.forEach(({ hash }) => { | ||
if (projects.filter((project) => project.hash === hash).length >= 2) { | ||
commonHashes.push(hash); | ||
} | ||
}); | ||
return commonHashes.length > 0; | ||
} | ||
} | ||
exports.PlaywrightReportSource = PlaywrightReportSource; |
{ | ||
"name": "@empiricalrun/reporter", | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"publishConfig": { | ||
@@ -30,4 +30,6 @@ "registry": "https://registry.npmjs.org/", | ||
"clean": "tsc --build --clean", | ||
"lint": "eslint ." | ||
"lint": "eslint .", | ||
"test": "vitest run", | ||
"test:watch": "vitest" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
55680
1250