@@ -9,11 +9,13 @@ const MAX_REPORT_LENGTH = 65535
9
9
export interface ReportOptions {
10
10
listSuites : 'all' | 'failed'
11
11
listTests : 'all' | 'failed' | 'none'
12
+ baseUrl : string
12
13
}
13
14
14
15
const defaultOptions : ReportOptions = {
15
16
listSuites : 'all' ,
16
- listTests : 'all'
17
+ listTests : 'all' ,
18
+ baseUrl : ''
17
19
}
18
20
19
21
export function getReport ( results : TestRunResult [ ] , options : ReportOptions = defaultOptions ) : string {
@@ -134,7 +136,7 @@ function getTestRunsReport(testRuns: TestRunResult[], options: ReportOptions): s
134
136
const tableData = testRuns . map ( ( tr , runIndex ) => {
135
137
const time = formatTime ( tr . time )
136
138
const name = tr . path
137
- const addr = makeRunSlug ( runIndex ) . link
139
+ const addr = options . baseUrl + makeRunSlug ( runIndex ) . link
138
140
const nameLink = link ( name , addr )
139
141
const passed = tr . passed > 0 ? `${ tr . passed } ${ Icon . success } ` : ''
140
142
const failed = tr . failed > 0 ? `${ tr . failed } ${ Icon . fail } ` : ''
@@ -159,7 +161,7 @@ function getSuitesReport(tr: TestRunResult, runIndex: number, options: ReportOpt
159
161
const sections : string [ ] = [ ]
160
162
161
163
const trSlug = makeRunSlug ( runIndex )
162
- const nameLink = `<a id="${ trSlug . id } " href="${ trSlug . link } ">${ tr . path } </a>`
164
+ const nameLink = `<a id="${ trSlug . id } " href="${ options . baseUrl + trSlug . link } ">${ tr . path } </a>`
163
165
const icon = getResultIcon ( tr . result )
164
166
sections . push ( `## ${ icon } \xa0${ nameLink } ` )
165
167
@@ -179,7 +181,7 @@ function getSuitesReport(tr: TestRunResult, runIndex: number, options: ReportOpt
179
181
const tsTime = formatTime ( s . time )
180
182
const tsName = s . name
181
183
const skipLink = options . listTests === 'none' || ( options . listTests === 'failed' && s . result !== 'failed' )
182
- const tsAddr = makeSuiteSlug ( runIndex , suiteIndex ) . link
184
+ const tsAddr = options . baseUrl + makeSuiteSlug ( runIndex , suiteIndex ) . link
183
185
const tsNameLink = skipLink ? tsName : link ( tsName , tsAddr )
184
186
const passed = s . passed > 0 ? `${ s . passed } ${ Icon . success } ` : ''
185
187
const failed = s . failed > 0 ? `${ s . failed } ${ Icon . fail } ` : ''
@@ -214,7 +216,7 @@ function getTestsReport(ts: TestSuiteResult, runIndex: number, suiteIndex: numbe
214
216
215
217
const tsName = ts . name
216
218
const tsSlug = makeSuiteSlug ( runIndex , suiteIndex )
217
- const tsNameLink = `<a id="${ tsSlug . id } " href="${ tsSlug . link } ">${ tsName } </a>`
219
+ const tsNameLink = `<a id="${ tsSlug . id } " href="${ options . baseUrl + tsSlug . link } ">${ tsName } </a>`
218
220
const icon = getResultIcon ( ts . result )
219
221
sections . push ( `### ${ icon } \xa0${ tsNameLink } ` )
220
222
0 commit comments