Remove 'Details' column from Test case report

Stack traces doesn't fit well into the table - there was not enough width for it.  Now the stack traces are included in annotations which looks much better
This commit is contained in:
Michal Dorner 2020-11-29 20:07:32 +01:00
parent 63b94a335a
commit bff3069f5c
No known key found for this signature in database
GPG key ID: 9EEE04B48DA36786
5 changed files with 34 additions and 96 deletions

View file

@ -2,7 +2,7 @@ import {Annotation, ParseOptions, TestResult} from '../test-parser'
import {parseStringPromise} from 'xml2js'
import {JunitReport, TestCase, TestSuite, TestSuites} from './jest-junit-types'
import {Align, Icon, link, table, exceptionCell} from '../../utils/markdown-utils'
import {Align, Icon, link, table} from '../../utils/markdown-utils'
import {normalizeFilePath} from '../../utils/file-utils'
import {slug} from '../../utils/slugger'
import {parseAttribute} from '../../utils/xml-utils'
@ -83,14 +83,13 @@ function getSuiteSummary(suite: TestSuite, index: number): string {
.map(grp => {
const header = grp.describe !== '' ? `#### ${grp.describe}\n\n` : ''
const tests = table(
['Result', 'Test', 'Time', 'Details'],
[Align.Center, Align.Left, Align.Right, Align.None],
['Result', 'Test', 'Time'],
[Align.Center, Align.Left, Align.Right],
...grp.tests.map(tc => {
const name = tc.$.name
const time = `${Math.round(tc.$.time * 1000)}ms`
const result = getTestCaseIcon(tc)
const ex = getTestCaseDetails(tc)
return [result, name, time, ex]
return [result, name, time]
})
)
@ -110,19 +109,6 @@ function getTestCaseIcon(test: TestCase): string {
return Icon.success
}
function getTestCaseDetails(test: TestCase): string {
if (test.skipped !== undefined) {
return 'Skipped'
}
if (test.failure !== undefined) {
const failure = test.failure.join('\n')
return exceptionCell(failure)
}
return ''
}
function makeSuiteSlug(index: number, name: string): {id: string; link: string} {
// use "ts-$index-" as prefix to avoid slug conflicts after escaping the paths
return slug(`ts-${index}-${name}`)