Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #82: net-trx parser crashing on missing duration attribute #86

Merged
merged 1 commit into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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