Merge pull request #86 from dorny/issue-82-net-trx-no-duration

Fixes #82: net-trx parser handles missing duration attribute
This commit is contained in:
Michal Dorner 2021-03-24 18:08:55 +01:00 committed by GitHub
commit 10268d2d6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 4 deletions

3
dist/index.js generated vendored
View file

@ -697,7 +697,8 @@ class DotnetTrxParser {
} }
const output = r.unitTestResult.Output; const output = r.unitTestResult.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 = (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 duration = parse_utils_1.parseNetDuration(r.unitTestResult.$.duration); const durationAttr = r.unitTestResult.$.duration;
const duration = durationAttr ? parse_utils_1.parseNetDuration(durationAttr) : 0;
const test = new Test(r.testMethod.$.name, r.unitTestResult.$.outcome, duration, error); const test = new Test(r.testMethod.$.name, r.unitTestResult.$.outcome, duration, error);
tc.tests.push(test); tc.tests.push(test);
} }

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -86,7 +86,9 @@ export class DotnetTrxParser implements TestParser {
} }
const output = r.unitTestResult.Output const output = r.unitTestResult.Output
const error = output?.length > 0 && output[0].ErrorInfo?.length > 0 ? output[0].ErrorInfo[0] : undefined const error = output?.length > 0 && output[0].ErrorInfo?.length > 0 ? output[0].ErrorInfo[0] : undefined
const duration = parseNetDuration(r.unitTestResult.$.duration) const durationAttr = r.unitTestResult.$.duration
const duration = durationAttr ? parseNetDuration(durationAttr) : 0
const test = new Test(r.testMethod.$.name, r.unitTestResult.$.outcome, duration, error) const test = new Test(r.testMethod.$.name, r.unitTestResult.$.outcome, duration, error)
tc.tests.push(test) tc.tests.push(test)
} }

View file

@ -43,7 +43,7 @@ export interface UnitTestResult {
$: { $: {
testId: string testId: string
testName: string testName: string
duration: string duration?: string
outcome: Outcome outcome: Outcome
} }
Output: Output[] Output: Output[]