Skip to content

Commit

Permalink
Attempt test-summary#1
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkc committed Apr 19, 2023
1 parent 4ffe674 commit 59f1db2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions dist/test_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,18 +219,23 @@ function parseJunitXml(xml) {
const name = testcase.$.name;
const duration = testcase.$.time;
let details = undefined;
let detailMessage = "";
if (testcase.skipped) {
status = TestStatus.Skip;
counts.skipped++;
}
else if (testcase.failure || testcase.error) {
status = TestStatus.Fail;
details = (testcase.failure || testcase.error)[0]._;
if (testcase.$.message && (testcase.$.message)[0]._) {
detailMessage = (testcase.$.message)[0]._ + "\n\n";
}
counts.failed++;
}
else {
counts.passed++;
}
details = `${detailMessage}${details}`;
cases.push({
status: status,
name: name,
Expand Down
8 changes: 7 additions & 1 deletion src/test_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ async function parseJunitXml(xml: any): Promise<TestResult> {
const duration = testcase.$.time

let details: string | undefined = undefined
let detailMessage: string = ""

if (testcase.skipped) {
status = TestStatus.Skip
Expand All @@ -244,11 +245,16 @@ async function parseJunitXml(xml: any): Promise<TestResult> {
} else if (testcase.failure || testcase.error) {
status = TestStatus.Fail
details = (testcase.failure || testcase.error)[0]._

if (testcase.$.message && (testcase.$.message)[0]._)
{
detailMessage = (testcase.$.message)[0]._ + "\n\n"
}
counts.failed++
} else {
counts.passed++
}

details = `${detailMessage}${details}`

cases.push({
status: status,
Expand Down

0 comments on commit 59f1db2

Please sign in to comment.