1
0
Fork 0
mirror of https://github.com/dorny/test-reporter.git synced 2026-03-22 07:52:14 +01:00

Correct test time output

This commit is contained in:
Shamus Taylor 2025-03-05 15:06:35 -06:00
parent e89b2f3e47
commit 3eeb9fc888
No known key found for this signature in database
GPG key ID: C44FC1AA547ACE39
5 changed files with 19 additions and 20 deletions

View file

@ -34,11 +34,10 @@ export class DotnetNunitLegacyParser implements TestParser {
private getTestRunResult(path: string, nunit: NunitReport): TestRunResult {
const suites: TestSuiteResult[] = []
const time = parseFloat(nunit['test-results'].$.time)
this.populateTestCasesRecursive(suites, [], nunit['test-results']['test-suite'])
return new TestRunResult(path, suites, time)
return new TestRunResult(path, suites)
}
private populateTestCasesRecursive(
@ -99,7 +98,7 @@ export class DotnetNunitLegacyParser implements TestParser {
new TestCaseResult(
testCase.$.name.startsWith(suiteName + '.') ? testCase.$.name.substring(suiteName.length + 1) : testCase.$.name,
this.getTestExecutionResult(testCase),
parseFloat(testCase.$.time),
testCase.$.time ? parseFloat(testCase.$.time) * 1000 : 0,
this.getTestCaseError(testCase)
)
)

View file

@ -4,7 +4,8 @@ export interface NunitReport {
export interface TestResults {
$: {
time: string
// there is a time attribute here, but it is the time of day the test ran, not the duration
// time: string
}
'test-suite'?: TestSuite[]
}
@ -26,7 +27,7 @@ export interface TestCase {
$: {
name: string
result: string
time: string
time?: string
}
failure?: TestFailure[]
reason?: TestFailure[]