mirror of
https://github.com/dorny/test-reporter.git
synced 2026-02-03 11:45:22 -08:00
Gracefully handle empty nested testsuite elements for JUnit.
This fixes an issue with mocha-junit-reporter returning empty root-level testsuite elements.
This commit is contained in:
@@ -48,6 +48,10 @@ export class JestJunitParser implements TestParser {
|
||||
}
|
||||
|
||||
private getGroups(suite: TestSuite): TestGroupResult[] {
|
||||
if (!suite.testcase) {
|
||||
return []
|
||||
}
|
||||
|
||||
const groups: {describe: string; tests: TestCase[]}[] = []
|
||||
for (const tc of suite.testcase) {
|
||||
let grp = groups.find(g => g.describe === tc.$.classname)
|
||||
|
||||
@@ -19,7 +19,7 @@ export interface TestSuite {
|
||||
time: string
|
||||
timestamp?: Date
|
||||
}
|
||||
testcase: TestCase[]
|
||||
testcase?: TestCase[]
|
||||
}
|
||||
|
||||
export interface TestCase {
|
||||
|
||||
Reference in New Issue
Block a user