mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-18 07:07:08 +01:00
Refactoring & cleanup of whole codebase
Improves report summary and annotations
This commit is contained in:
parent
07a0223ee3
commit
60b35d601a
20 changed files with 38784 additions and 33667 deletions
|
|
@ -1,89 +0,0 @@
|
|||
export class TestRunResult {
|
||||
constructor(readonly path: string, readonly suites: TestSuiteResult[], private totalTime?: number) {}
|
||||
|
||||
get tests(): number {
|
||||
return this.suites.reduce((sum, g) => sum + g.tests, 0)
|
||||
}
|
||||
|
||||
get passed(): number {
|
||||
return this.suites.reduce((sum, g) => sum + g.passed, 0)
|
||||
}
|
||||
get failed(): number {
|
||||
return this.suites.reduce((sum, g) => sum + g.failed, 0)
|
||||
}
|
||||
get skipped(): number {
|
||||
return this.suites.reduce((sum, g) => sum + g.skipped, 0)
|
||||
}
|
||||
|
||||
get time(): number {
|
||||
return this.totalTime ?? this.suites.reduce((sum, g) => sum + g.time, 0)
|
||||
}
|
||||
|
||||
get result(): TestExecutionResult {
|
||||
return this.suites.some(t => t.result === 'failed') ? 'failed' : 'success'
|
||||
}
|
||||
|
||||
get failedSuites(): TestSuiteResult[] {
|
||||
return this.suites.filter(s => s.result === 'failed')
|
||||
}
|
||||
}
|
||||
|
||||
export class TestSuiteResult {
|
||||
constructor(readonly name: string, readonly groups: TestGroupResult[], private totalTime?: number) {}
|
||||
|
||||
get tests(): number {
|
||||
return this.groups.reduce((sum, g) => sum + g.tests.length, 0)
|
||||
}
|
||||
|
||||
get passed(): number {
|
||||
return this.groups.reduce((sum, g) => sum + g.passed, 0)
|
||||
}
|
||||
get failed(): number {
|
||||
return this.groups.reduce((sum, g) => sum + g.failed, 0)
|
||||
}
|
||||
get skipped(): number {
|
||||
return this.groups.reduce((sum, g) => sum + g.skipped, 0)
|
||||
}
|
||||
get time(): number {
|
||||
return this.totalTime ?? this.groups.reduce((sum, g) => sum + g.time, 0)
|
||||
}
|
||||
|
||||
get result(): TestExecutionResult {
|
||||
return this.groups.some(t => t.result === 'failed') ? 'failed' : 'success'
|
||||
}
|
||||
|
||||
get failedGroups(): TestGroupResult[] {
|
||||
return this.groups.filter(grp => grp.result === 'failed')
|
||||
}
|
||||
}
|
||||
|
||||
export class TestGroupResult {
|
||||
constructor(readonly name: string | undefined | null, readonly tests: TestCaseResult[]) {}
|
||||
|
||||
get passed(): number {
|
||||
return this.tests.reduce((sum, t) => (t.result === 'success' ? sum + 1 : sum), 0)
|
||||
}
|
||||
get failed(): number {
|
||||
return this.tests.reduce((sum, t) => (t.result === 'failed' ? sum + 1 : sum), 0)
|
||||
}
|
||||
get skipped(): number {
|
||||
return this.tests.reduce((sum, t) => (t.result === 'skipped' ? sum + 1 : sum), 0)
|
||||
}
|
||||
get time(): number {
|
||||
return this.tests.reduce((sum, t) => sum + t.time, 0)
|
||||
}
|
||||
|
||||
get result(): TestExecutionResult {
|
||||
return this.tests.some(t => t.result === 'failed') ? 'failed' : 'success'
|
||||
}
|
||||
|
||||
get failedTests(): TestCaseResult[] {
|
||||
return this.tests.filter(tc => tc.result === 'failed')
|
||||
}
|
||||
}
|
||||
|
||||
export class TestCaseResult {
|
||||
constructor(readonly name: string, readonly result: TestExecutionResult, readonly time: number) {}
|
||||
}
|
||||
|
||||
export type TestExecutionResult = 'success' | 'skipped' | 'failed' | undefined
|
||||
Loading…
Add table
Add a link
Reference in a new issue