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

@ -21,32 +21,12 @@ export function link(title: string, address: string): string {
type ToString = string | number | boolean | Date
export function table(headers: ToString[], align: ToString[], ...rows: ToString[][]): string {
const headerRow = `| ${headers.join(' | ')} |`
const headerRow = `| ${headers.map(tableEscape).join(' | ')} |`
const alignRow = `| ${align.join(' | ')} |`
const contentRows = rows.map(row => `| ${row.join(' | ')} |`).join('\n')
const contentRows = rows.map(row => `| ${row.map(tableEscape).join(' | ')} |`).join('\n')
return [headerRow, alignRow, contentRows].join('\n')
}
export function exceptionCell(ex: string): string {
const lines = ex.split(/\r?\n/)
if (lines.length === 0) {
return ''
}
const summary = tableEscape(lines.shift()?.trim() || '')
const emptyLine = /^\s*$/
const firstNonEmptyLine = lines.findIndex(l => !emptyLine.test(l))
if (firstNonEmptyLine === -1) {
return summary
}
const contentLines = firstNonEmptyLine > 0 ? lines.slice(firstNonEmptyLine) : lines
const content = '<pre>' + tableEscape(contentLines.join('<br>')) + '</pre>'
return details(summary, content)
}
export function tableEscape(content: string): string {
return content.replace('|', '\\|')
export function tableEscape(content: ToString): string {
return content.toString().replace('|', '\\|')
}