diff --git a/src/parsers/dotnet-trx/dotnet-trx-parser.ts b/src/parsers/dotnet-trx/dotnet-trx-parser.ts
index 4749190..22f07a7 100644
--- a/src/parsers/dotnet-trx/dotnet-trx-parser.ts
+++ b/src/parsers/dotnet-trx/dotnet-trx-parser.ts
@@ -151,9 +151,10 @@ export class DotnetTrxParser implements TestParser {
return undefined;
}
- const message = error.Message[0];
- const stackTrace = error.StackTrace[0];
- const stdOut = test.stdOut || ''; // Use StdOut from Test object
+ const message = test.error.Message[0];
+ const stackTrace = test.error.StackTrace[0];
+ const stdOut = test.stdOut || ''; // Add StdOut
+
let path;
let line;
@@ -167,7 +168,8 @@ export class DotnetTrxParser implements TestParser {
path,
line,
message,
- details: `${message}\n${stackTrace}\n${stdOut}`,
+ details: `${message}\n${stackTrace}`,
+ stdOut, // Include StdOut in TestCaseError
};
}
diff --git a/src/report/get-report.ts b/src/report/get-report.ts
index 99bf270..abdd256 100644
--- a/src/report/get-report.ts
+++ b/src/report/get-report.ts
@@ -230,45 +230,56 @@ function getSuitesReport(tr: TestRunResult, runIndex: number, options: ReportOpt
function getTestsReport(ts: TestSuiteResult, runIndex: number, suiteIndex: number, options: ReportOptions): string[] {
if (options.listTests === 'failed' && ts.result !== 'failed') {
- return []
+ return [];
}
- const groups = ts.groups
+ const groups = ts.groups;
if (groups.length === 0) {
- return []
+ return [];
}
- const sections: string[] = []
+ const sections: string[] = [];
- const tsName = ts.name
- const tsSlug = makeSuiteSlug(runIndex, suiteIndex)
- const tsNameLink = `${tsName}`
- const icon = getResultIcon(ts.result)
- sections.push(`### ${icon}\xa0${tsNameLink}`)
+ const tsName = ts.name;
+ const tsSlug = makeSuiteSlug(runIndex, suiteIndex);
+ const tsNameLink = `${tsName}`;
+ const icon = getResultIcon(ts.result);
+ sections.push(`### ${icon}\xa0${tsNameLink}`);
- sections.push('```')
+ sections.push('```');
for (const grp of groups) {
if (grp.name) {
- sections.push(grp.name)
+ sections.push(grp.name);
}
- const space = grp.name ? ' ' : ''
+ const space = grp.name ? ' ' : '';
for (const tc of grp.tests) {
- const result = getResultIcon(tc.result)
- sections.push(`${space}${result} ${tc.name}`)
+ const result = getResultIcon(tc.result);
+ sections.push(`${space}${result} ${tc.name}`);
if (tc.error) {
- const lines = (tc.error.message ?? getFirstNonEmptyLine(tc.error.details)?.trim())
- ?.split(/\r?\n/g)
- .map(l => '\t' + l)
- if (lines) {
- sections.push(...lines)
+ const errorDetails: string[] = [];
+
+ if (tc.error.message) {
+ errorDetails.push(tc.error.message);
}
+ if (tc.error.details) {
+ errorDetails.push(tc.error.details);
+ }
+ if (tc.error.stdOut) {
+ errorDetails.push(`StdOut:\n${tc.error.stdOut}`); // Include StdOut in report
+ }
+
+ const lines = errorDetails.flatMap((detail) =>
+ detail.split(/\r?\n/g).map((line) => `\t${line}`)
+ );
+ sections.push(...lines);
}
}
}
- sections.push('```')
+ sections.push('```');
- return sections
+ return sections;
}
+
function makeRunSlug(runIndex: number): {id: string; link: string} {
// use prefix to avoid slug conflicts after escaping the paths
return slug(`r${runIndex}`)
diff --git a/src/test-results.ts b/src/test-results.ts
index bca8c41..1f6343a 100644
--- a/src/test-results.ts
+++ b/src/test-results.ts
@@ -129,8 +129,10 @@ export class TestCaseResult {
export type TestExecutionResult = 'success' | 'skipped' | 'failed' | undefined
export interface TestCaseError {
- path?: string
- line?: number
- message?: string
- details: string
+ path?: string;
+ line?: number;
+ message: string;
+ details: string;
+ stdOut?: string;
}
+