Report: round times and skip Test Suites section if it's empty

This commit is contained in:
Michal Dorner 2021-01-25 13:18:02 +01:00
parent 7c339256a1
commit 768aefbed2
No known key found for this signature in database
GPG key ID: 9EEE04B48DA36786
5 changed files with 25 additions and 21 deletions

View file

@ -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]
})