diff --git a/__tests__/__outputs__/junit-with-message.md b/__tests__/__outputs__/junit-with-message.md
new file mode 100644
index 0000000..948309a
--- /dev/null
+++ b/__tests__/__outputs__/junit-with-message.md
@@ -0,0 +1,15 @@
+
+|Report|Passed|Failed|Skipped|Time|
+|:---|---:|---:|---:|---:|
+|fixtures/junit-with-message.xml||1 ❌||1ms|
+## ❌ fixtures/junit-with-message.xml
+**1** tests were completed in **1ms** with **0** passed, **1** failed and **0** skipped.
+|Test suite|Passed|Failed|Skipped|Time|
+|:---|---:|---:|---:|---:|
+|[Test](#r0s0)||1 ❌||1ms|
+### ❌ Test
+```
+Fails
+ ❌ Test
+ error.cpp:01
+```
\ No newline at end of file
diff --git a/__tests__/__snapshots__/jest-junit.test.ts.snap b/__tests__/__snapshots__/jest-junit.test.ts.snap
index fd1e839..eb20dfe 100644
--- a/__tests__/__snapshots__/jest-junit.test.ts.snap
+++ b/__tests__/__snapshots__/jest-junit.test.ts.snap
@@ -26,6 +26,38 @@ TestRunResult {
}
`;
+exports[`jest-junit tests parsing junit report with message succeeds 1`] = `
+TestRunResult {
+ "path": "fixtures/junit-with-message.xml",
+ "suites": [
+ TestSuiteResult {
+ "groups": [
+ TestGroupResult {
+ "name": "Fails",
+ "tests": [
+ TestCaseResult {
+ "error": {
+ "details": "error.cpp:01
+ Expected: true
+ Which is: false >",
+ "line": undefined,
+ "path": undefined,
+ },
+ "name": "Test",
+ "result": "failed",
+ "time": 0,
+ },
+ ],
+ },
+ ],
+ "name": "Test",
+ "totalTime": 1,
+ },
+ ],
+ "totalTime": 1,
+}
+`;
+
exports[`jest-junit tests report from #235 testing react components named 1`] = `
TestRunResult {
"path": "fixtures/external/jest/jest-react-component-test-results.xml",
diff --git a/__tests__/fixtures/junit-with-message.xml b/__tests__/fixtures/junit-with-message.xml
new file mode 100644
index 0000000..2e3d584
--- /dev/null
+++ b/__tests__/fixtures/junit-with-message.xml
@@ -0,0 +1,10 @@
+
+
+
+
+ ]]>
+
+
+
diff --git a/__tests__/jest-junit.test.ts b/__tests__/jest-junit.test.ts
index 751893a..d52c047 100644
--- a/__tests__/jest-junit.test.ts
+++ b/__tests__/jest-junit.test.ts
@@ -125,4 +125,24 @@ describe('jest-junit tests', () => {
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
fs.writeFileSync(outputPath, report)
})
+
+ it('parsing junit report with message succeeds', async () => {
+ const fixturePath = path.join(__dirname, 'fixtures', 'junit-with-message.xml')
+ const outputPath = path.join(__dirname, '__outputs__', 'junit-with-message.md')
+ const filePath = normalizeFilePath(path.relative(__dirname, fixturePath))
+ const fileContent = fs.readFileSync(fixturePath, {encoding: 'utf8'})
+
+ const opts: ParseOptions = {
+ parseErrors: true,
+ trackedFiles: ['test.js']
+ }
+
+ const parser = new JestJunitParser(opts)
+ const result = await parser.parse(filePath, fileContent)
+ expect(result).toMatchSnapshot()
+
+ const report = getReport([result])
+ fs.mkdirSync(path.dirname(outputPath), {recursive: true})
+ fs.writeFileSync(outputPath, report)
+ })
})
diff --git a/src/parsers/jest-junit/jest-junit-parser.ts b/src/parsers/jest-junit/jest-junit-parser.ts
index be009a9..6631d00 100644
--- a/src/parsers/jest-junit/jest-junit-parser.ts
+++ b/src/parsers/jest-junit/jest-junit-parser.ts
@@ -85,7 +85,7 @@ export class JestJunitParser implements TestParser {
return undefined
}
- const details = tc.failure[0]
+ const details = typeof tc.failure[0] === 'string' ? tc.failure[0] : tc.failure[0]['_']
let path
let line