fix report urls

This commit is contained in:
rogerswingle 2024-08-28 07:51:40 -04:00
parent 95058abb17
commit e125c5f285
No known key found for this signature in database
GPG key ID: DAE0A0F70487EE88
2 changed files with 59762 additions and 59762 deletions

20
dist/index.js generated vendored
View file

@ -1854,18 +1854,18 @@ function getTestRunsReport(testRuns, options) {
sections.push(`<details><summary>Expand for details</summary>`);
sections.push(` `);
}
if (testRuns.length > 0 || options.onlySummary) {
const tableData = testRuns
.filter(tr => tr.passed > 0 || tr.failed > 0 || tr.skipped > 0)
.map(tr => {
if (testRuns.length > 1 || options.onlySummary) {
const tableData = testRuns.map((tr, runIndex) => {
const time = (0, markdown_utils_1.formatTime)(tr.time);
const name = tr.path;
const addr = options.baseUrl + makeRunSlug(runIndex).link;
const nameLink = (0, markdown_utils_1.link)(name, addr);
const passed = tr.passed > 0 ? `${tr.passed}${markdown_utils_1.Icon.success}` : '';
const failed = tr.failed > 0 ? `${tr.failed}${markdown_utils_1.Icon.fail}` : '';
const skipped = tr.skipped > 0 ? `${tr.skipped}${markdown_utils_1.Icon.skip}` : '';
return [name, passed, failed, skipped, time];
return [nameLink, passed, failed, skipped, time, addr, options.baseUrl];
});
const resultsTable = (0, markdown_utils_1.table)(['Report', 'Passed', 'Failed', 'Skipped', 'Time'], [markdown_utils_1.Align.Left, markdown_utils_1.Align.Right, markdown_utils_1.Align.Right, markdown_utils_1.Align.Right, markdown_utils_1.Align.Right], ...tableData);
const resultsTable = (0, markdown_utils_1.table)(['Report', 'Passed', 'Failed', 'Skipped', 'Time', 'Addr', 'Base'], [markdown_utils_1.Align.Left, markdown_utils_1.Align.Right, markdown_utils_1.Align.Right, markdown_utils_1.Align.Right, markdown_utils_1.Align.Right, markdown_utils_1.Align.Right, markdown_utils_1.Align.Right], ...tableData);
sections.push(resultsTable);
}
if (options.onlySummary === false) {
@ -1894,9 +1894,9 @@ function getSuitesReport(tr, runIndex, options) {
const suitesTable = (0, markdown_utils_1.table)(['Test suite', 'Passed', 'Failed', 'Skipped', 'Time'], [markdown_utils_1.Align.Left, markdown_utils_1.Align.Right, markdown_utils_1.Align.Right, markdown_utils_1.Align.Right, markdown_utils_1.Align.Right], ...suites.map((s, suiteIndex) => {
const tsTime = (0, markdown_utils_1.formatTime)(s.time);
const tsName = s.name;
const skipLink = options.listTests === 'none' || (options.listTests === 'failed' && s.result !== 'failed');
// const skipLink = options.listTests === 'none' || (options.listTests === 'failed' && s.result !== 'failed')
const tsAddr = options.baseUrl + makeSuiteSlug(runIndex, suiteIndex).link;
const tsNameLink = skipLink ? tsName : (0, markdown_utils_1.link)(tsName, tsAddr);
const tsNameLink = (0, markdown_utils_1.link)(tsName, tsAddr);
const passed = s.passed > 0 ? `${s.passed} ${markdown_utils_1.Icon.success}` : '';
const failed = s.failed > 0 ? `${s.failed} ${markdown_utils_1.Icon.fail}` : '';
const skipped = s.skipped > 0 ? `${s.skipped} ${markdown_utils_1.Icon.skip}` : '';
@ -1951,11 +1951,11 @@ function getTestsReport(ts, runIndex, suiteIndex, options) {
}
function makeRunSlug(runIndex) {
// use prefix to avoid slug conflicts after escaping the paths
return (0, slugger_1.slug)(`r${runIndex}`);
return (0, slugger_1.slug)(`user-content-r${runIndex}`);
}
function makeSuiteSlug(runIndex, suiteIndex) {
// use prefix to avoid slug conflicts after escaping the paths
return (0, slugger_1.slug)(`r${runIndex}s${suiteIndex}`);
return (0, slugger_1.slug)(`user-content-r${runIndex}s${suiteIndex}`);
}
function getResultIcon(result) {
switch (result) {

View file

@ -149,21 +149,21 @@ function getTestRunsReport(testRuns: TestRunResult[], options: ReportOptions): s
sections.push(` `)
}
if (testRuns.length > 0 || options.onlySummary) {
const tableData = testRuns
.filter(tr => tr.passed > 0 || tr.failed > 0 || tr.skipped > 0)
.map(tr => {
if (testRuns.length > 1 || options.onlySummary) {
const tableData = testRuns.map((tr, runIndex) => {
const time = formatTime(tr.time)
const name = tr.path
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}` : ''
const skipped = tr.skipped > 0 ? `${tr.skipped}${Icon.skip}` : ''
return [name, passed, failed, skipped, time]
return [nameLink, passed, failed, skipped, time, addr, options.baseUrl]
})
const resultsTable = table(
['Report', 'Passed', 'Failed', 'Skipped', 'Time'],
[Align.Left, Align.Right, Align.Right, Align.Right, Align.Right],
['Report', 'Passed', 'Failed', 'Skipped', 'Time', 'Addr', 'Base'],
[Align.Left, Align.Right, Align.Right, Align.Right, Align.Right, Align.Right, Align.Right],
...tableData
)
sections.push(resultsTable)
@ -204,9 +204,9 @@ function getSuitesReport(tr: TestRunResult, runIndex: number, options: ReportOpt
...suites.map((s, suiteIndex) => {
const tsTime = formatTime(s.time)
const tsName = s.name
const skipLink = options.listTests === 'none' || (options.listTests === 'failed' && s.result !== 'failed')
// const skipLink = options.listTests === 'none' || (options.listTests === 'failed' && s.result !== 'failed')
const tsAddr = options.baseUrl + makeSuiteSlug(runIndex, suiteIndex).link
const tsNameLink = skipLink ? tsName : link(tsName, tsAddr)
const tsNameLink = link(tsName, tsAddr)
const passed = s.passed > 0 ? `${s.passed} ${Icon.success}` : ''
const failed = s.failed > 0 ? `${s.failed} ${Icon.fail}` : ''
const skipped = s.skipped > 0 ? `${s.skipped} ${Icon.skip}` : ''
@ -271,12 +271,12 @@ function getTestsReport(ts: TestSuiteResult, runIndex: number, suiteIndex: numbe
function makeRunSlug(runIndex: number): {id: string; link: string} {
// use prefix to avoid slug conflicts after escaping the paths
return slug(`r${runIndex}`)
return slug(`user-content-r${runIndex}`)
}
function makeSuiteSlug(runIndex: number, suiteIndex: number): {id: string; link: string} {
// use prefix to avoid slug conflicts after escaping the paths
return slug(`r${runIndex}s${suiteIndex}`)
return slug(`user-content-r${runIndex}s${suiteIndex}`)
}
function getResultIcon(result: TestExecutionResult): string {