mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 06:17:10 +01:00
Fix dotnet-trx parser failing on passed tests with non-empty error info
This commit is contained in:
parent
4fcb1ce90b
commit
43d89d5ee5
7 changed files with 1431 additions and 7 deletions
20
dist/index.js
generated
vendored
20
dist/index.js
generated
vendored
|
|
@ -702,7 +702,6 @@ class DotnetTrxParser {
|
|||
}
|
||||
}
|
||||
getTestClasses(trx) {
|
||||
var _a;
|
||||
if (trx.TestRun.TestDefinitions === undefined || trx.TestRun.Results === undefined) {
|
||||
return [];
|
||||
}
|
||||
|
|
@ -724,8 +723,7 @@ class DotnetTrxParser {
|
|||
tc = new TestClass(className);
|
||||
testClasses[tc.name] = tc;
|
||||
}
|
||||
const output = r.result.Output;
|
||||
const error = (output === null || output === void 0 ? void 0 : output.length) > 0 && ((_a = output[0].ErrorInfo) === null || _a === void 0 ? void 0 : _a.length) > 0 ? output[0].ErrorInfo[0] : undefined;
|
||||
const error = this.getErrorInfo(r.result);
|
||||
const durationAttr = r.result.$.duration;
|
||||
const duration = durationAttr ? parse_utils_1.parseNetDuration(durationAttr) : 0;
|
||||
const resultTestName = r.result.$.testName;
|
||||
|
|
@ -751,10 +749,26 @@ class DotnetTrxParser {
|
|||
});
|
||||
return new test_results_1.TestRunResult(path, suites, totalTime);
|
||||
}
|
||||
getErrorInfo(testResult) {
|
||||
var _a;
|
||||
if (testResult.$.outcome !== 'Failed') {
|
||||
return undefined;
|
||||
}
|
||||
const output = testResult.Output;
|
||||
const error = (output === null || output === void 0 ? void 0 : output.length) > 0 && ((_a = output[0].ErrorInfo) === null || _a === void 0 ? void 0 : _a.length) > 0 ? output[0].ErrorInfo[0] : undefined;
|
||||
return error;
|
||||
}
|
||||
getError(test) {
|
||||
if (!this.options.parseErrors || !test.error) {
|
||||
return undefined;
|
||||
}
|
||||
const error = test.error;
|
||||
if (!Array.isArray(error.Message)
|
||||
|| error.Message.length === 0
|
||||
|| !Array.isArray(error.StackTrace)
|
||||
|| error.StackTrace.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
const message = test.error.Message[0];
|
||||
const stackTrace = test.error.StackTrace[0];
|
||||
let path;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue