Skip to content

Commit

Permalink
Merge pull request #86 from dorny/issue-82-net-trx-no-duration
Browse files Browse the repository at this point in the history
Fixes #82: net-trx parser handles missing duration attribute
  • Loading branch information
dorny authored Mar 24, 2021
2 parents faaff05 + d29a37e commit 10268d2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/parsers/dotnet-trx/dotnet-trx-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ export class DotnetTrxParser implements TestParser {
}
const output = r.unitTestResult.Output
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)
tc.tests.push(test)
}
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/dotnet-trx/dotnet-trx-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export interface UnitTestResult {
$: {
testId: string
testName: string
duration: string
duration?: string
outcome: Outcome
}
Output: Output[]
Expand Down

0 comments on commit 10268d2

Please sign in to comment.