Handle test reports with no test cases

This commit is contained in:
Michal Dorner 2021-03-07 10:34:20 +01:00
parent a1cbedbccb
commit a9749e3840
No known key found for this signature in database
GPG key ID: 9EEE04B48DA36786
13 changed files with 114 additions and 18 deletions

View file

@ -32,12 +32,15 @@ export class JestJunitParser implements TestParser {
}
private getTestRunResult(path: string, junit: JunitReport): TestRunResult {
const suites = junit.testsuites.testsuite.map(ts => {
const name = ts.$.name.trim()
const time = parseFloat(ts.$.time) * 1000
const sr = new TestSuiteResult(name, this.getGroups(ts), time)
return sr
})
const suites =
junit.testsuites.testsuite === undefined
? []
: junit.testsuites.testsuite.map(ts => {
const name = ts.$.name.trim()
const time = parseFloat(ts.$.time) * 1000
const sr = new TestSuiteResult(name, this.getGroups(ts), time)
return sr
})
const time = parseFloat(junit.testsuites.$.time) * 1000
return new TestRunResult(path, suites, time)