mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 14:27:10 +01:00
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:
parent
63b94a335a
commit
bff3069f5c
5 changed files with 34 additions and 96 deletions
|
|
@ -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}`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue