mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-15 13:57:09 +01:00
Do not print a title if none is specified in the config
This commit is contained in:
parent
0840d7c281
commit
2b2d091d3d
20 changed files with 52 additions and 28 deletions
|
|
@ -15,7 +15,7 @@ export interface ReportOptions {
|
|||
onlySummary: boolean
|
||||
useActionsSummary: boolean
|
||||
badgeTitle: string
|
||||
reportTitle: string
|
||||
reportTitle?: string
|
||||
}
|
||||
|
||||
const defaultOptions: ReportOptions = {
|
||||
|
|
@ -24,8 +24,7 @@ const defaultOptions: ReportOptions = {
|
|||
baseUrl: '',
|
||||
onlySummary: false,
|
||||
useActionsSummary: true,
|
||||
badgeTitle: 'tests',
|
||||
reportTitle: 'Test Results'
|
||||
badgeTitle: 'tests'
|
||||
}
|
||||
|
||||
export function getReport(results: TestRunResult[], options: ReportOptions = defaultOptions): string {
|
||||
|
|
@ -103,7 +102,12 @@ function getByteLength(text: string): number {
|
|||
|
||||
function renderReport(results: TestRunResult[], options: ReportOptions): string[] {
|
||||
const sections: string[] = []
|
||||
sections.push(`# ${options.reportTitle}`)
|
||||
|
||||
const {reportTitle} = options
|
||||
// Suppress the report title for empty string or whitespace
|
||||
if (reportTitle && reportTitle.trim()) {
|
||||
sections.push(`# ${reportTitle}`)
|
||||
}
|
||||
|
||||
const badge = getReportBadge(results, options)
|
||||
sections.push(badge)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue