mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-15 22:07:09 +01:00
Report: round times and skip Test Suites section if it's empty
This commit is contained in:
parent
7c339256a1
commit
768aefbed2
5 changed files with 25 additions and 21 deletions
|
|
@ -29,8 +29,10 @@ export function getReport(results: TestRunResult[], options: ReportOptions = {})
|
|||
.flat()
|
||||
.join('\n')
|
||||
|
||||
const suitesSection = `# Test Suites\n\n${suitesSummary}`
|
||||
sections.push(suitesSection)
|
||||
if (suitesSummary !== '') {
|
||||
const suitesSection = `# Test Suites\n\n${suitesSummary}`
|
||||
sections.push(suitesSection)
|
||||
}
|
||||
}
|
||||
|
||||
const report = sections.join('\n\n')
|
||||
|
|
@ -79,7 +81,7 @@ function getRunSummary(tr: TestRunResult, runIndex: number, options: ReportOptio
|
|||
const suites = options.listSuites === 'only-failed' ? tr.failedSuites : tr.suites
|
||||
const suitesSummary = suites.map((s, suiteIndex) => {
|
||||
const icon = getResultIcon(s.result)
|
||||
const tsTime = `${s.time}ms`
|
||||
const tsTime = `${Math.round(s.time)}ms`
|
||||
const tsName = s.name
|
||||
const tsAddr = makeSuiteSlug(runIndex, suiteIndex, tsName).link
|
||||
const tsNameLink = link(tsName, tsAddr)
|
||||
|
|
@ -117,7 +119,7 @@ function getSuiteSummary(ts: TestSuiteResult, runIndex: number, suiteIndex: numb
|
|||
[Align.Center, Align.Left, Align.Right],
|
||||
...grp.tests.map(tc => {
|
||||
const name = tc.name
|
||||
const time = `${tc.time}ms`
|
||||
const time = `${Math.round(tc.time)}ms`
|
||||
const result = getResultIcon(tc.result)
|
||||
return [result, name, time]
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue