mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 06:17:10 +01:00
Use full URL to link test suites
GitHub UI for some unknown reason navigates user to check run with `check_suite_focus=true` query argument. With this argument unfortunately navigation to document ID with `#something` doesn't work
This commit is contained in:
parent
f48646179b
commit
fab342311c
4 changed files with 45 additions and 19 deletions
|
|
@ -9,11 +9,13 @@ const MAX_REPORT_LENGTH = 65535
|
|||
export interface ReportOptions {
|
||||
listSuites: 'all' | 'failed'
|
||||
listTests: 'all' | 'failed' | 'none'
|
||||
baseUrl: string
|
||||
}
|
||||
|
||||
const defaultOptions: ReportOptions = {
|
||||
listSuites: 'all',
|
||||
listTests: 'all'
|
||||
listTests: 'all',
|
||||
baseUrl: ''
|
||||
}
|
||||
|
||||
export function getReport(results: TestRunResult[], options: ReportOptions = defaultOptions): string {
|
||||
|
|
@ -134,7 +136,7 @@ function getTestRunsReport(testRuns: TestRunResult[], options: ReportOptions): s
|
|||
const tableData = testRuns.map((tr, runIndex) => {
|
||||
const time = formatTime(tr.time)
|
||||
const name = tr.path
|
||||
const addr = makeRunSlug(runIndex).link
|
||||
const addr = options.baseUrl + makeRunSlug(runIndex).link
|
||||
const nameLink = link(name, addr)
|
||||
const passed = tr.passed > 0 ? `${tr.passed}${Icon.success}` : ''
|
||||
const failed = tr.failed > 0 ? `${tr.failed}${Icon.fail}` : ''
|
||||
|
|
@ -159,7 +161,7 @@ function getSuitesReport(tr: TestRunResult, runIndex: number, options: ReportOpt
|
|||
const sections: string[] = []
|
||||
|
||||
const trSlug = makeRunSlug(runIndex)
|
||||
const nameLink = `<a id="${trSlug.id}" href="${trSlug.link}">${tr.path}</a>`
|
||||
const nameLink = `<a id="${trSlug.id}" href="${options.baseUrl + trSlug.link}">${tr.path}</a>`
|
||||
const icon = getResultIcon(tr.result)
|
||||
sections.push(`## ${icon}\xa0${nameLink}`)
|
||||
|
||||
|
|
@ -214,7 +216,7 @@ function getTestsReport(ts: TestSuiteResult, runIndex: number, suiteIndex: numbe
|
|||
|
||||
const tsName = ts.name
|
||||
const tsSlug = makeSuiteSlug(runIndex, suiteIndex)
|
||||
const tsNameLink = `<a id="${tsSlug.id}" href="${tsSlug.link}">${tsName}</a>`
|
||||
const tsNameLink = `<a id="${tsSlug.id}" href="${options.baseUrl + tsSlug.link}">${tsName}</a>`
|
||||
const icon = getResultIcon(ts.result)
|
||||
sections.push(`### ${icon}\xa0${tsNameLink}`)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue