Add support for mocha-json

This commit is contained in:
Michal Dorner 2021-02-23 22:39:35 +01:00
parent f285c4c6d7
commit 9b675bd55f
No known key found for this signature in database
GPG key ID: 9EEE04B48DA36786
21 changed files with 1588 additions and 59 deletions

View file

@ -26,6 +26,15 @@ export class TestRunResult {
get failedSuites(): TestSuiteResult[] {
return this.suites.filter(s => s.result === 'failed')
}
sort(deep: boolean): void {
this.suites.sort((a, b) => a.name.localeCompare(b.name))
if (deep) {
for (const suite of this.suites) {
suite.sort(deep)
}
}
}
}
export class TestSuiteResult {
@ -55,6 +64,15 @@ export class TestSuiteResult {
get failedGroups(): TestGroupResult[] {
return this.groups.filter(grp => grp.result === 'failed')
}
sort(deep: boolean): void {
this.groups.sort((a, b) => (a.name ?? '').localeCompare(b.name ?? ''))
if (deep) {
for (const grp of this.groups) {
grp.sort()
}
}
}
}
export class TestGroupResult {
@ -80,6 +98,10 @@ export class TestGroupResult {
get failedTests(): TestCaseResult[] {
return this.tests.filter(tc => tc.result === 'failed')
}
sort(): void {
this.tests.sort((a, b) => a.name.localeCompare(b.name))
}
}
export class TestCaseResult {