diff --git a/src/test_parser.ts b/src/test_parser.ts index d94e21b..6265ebd 100644 --- a/src/test_parser.ts +++ b/src/test_parser.ts @@ -312,7 +312,7 @@ export async function parseFile(filename: string): Promise { const xml: any = await parser(data) - if (xml.testsuites || xml.testsuite) { + if ('testsuites' in xml || 'testsuite' in xml) { return await parseJunitXml(xml) } diff --git a/test/file.ts b/test/file.ts index 782505e..3b27665 100644 --- a/test/file.ts +++ b/test/file.ts @@ -55,4 +55,11 @@ describe("file", async () => { expect(result.counts.failed).to.eql(4) expect(result.counts.skipped).to.eql(2) }) + + it("identifies empty junit", async () => { + const result = await parseFile(`${junitResourcePath}/05-empty.xml`) + expect(result.counts.passed).to.eql(0) + expect(result.counts.failed).to.eql(0) + expect(result.counts.skipped).to.eql(0) + }) })