Add dist changes

This commit is contained in:
Michael Marcus 2025-03-25 15:10:26 -04:00
parent 314ef1dd49
commit 8039983cdb

22
dist/index.js generated vendored
View file

@ -1931,7 +1931,7 @@ function getSuitesReport(tr, runIndex, options) {
const sections = []; const sections = [];
const suites = options.listSuites === 'failed' ? tr.failedSuites : tr.suites; const suites = options.listSuites === 'failed' ? tr.failedSuites : tr.suites;
if (options.listSuites !== 'none') { if (options.listSuites !== 'none') {
const trSlug = makeRunSlug(runIndex); const trSlug = makeRunSlug(runIndex, options);
const nameLink = `<a id="${trSlug.id}" href="${options.baseUrl + trSlug.link}">${tr.path}</a>`; const nameLink = `<a id="${trSlug.id}" href="${options.baseUrl + trSlug.link}">${tr.path}</a>`;
const icon = getResultIcon(tr.result); const icon = getResultIcon(tr.result);
sections.push(`## ${icon}\xa0${nameLink}`); sections.push(`## ${icon}\xa0${nameLink}`);
@ -1945,7 +1945,7 @@ function getSuitesReport(tr, runIndex, options) {
const tsTime = (0, markdown_utils_1.formatTime)(s.time); const tsTime = (0, markdown_utils_1.formatTime)(s.time);
const tsName = s.name; 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 tsAddr = options.baseUrl + makeSuiteSlug(runIndex, suiteIndex, options).link;
const tsNameLink = skipLink ? tsName : (0, markdown_utils_1.link)(tsName, tsAddr); const tsNameLink = skipLink ? tsName : (0, markdown_utils_1.link)(tsName, tsAddr);
const passed = s.passed > 0 ? `${s.passed} ${markdown_utils_1.Icon.success}` : ''; 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 failed = s.failed > 0 ? `${s.failed} ${markdown_utils_1.Icon.fail}` : '';
@ -1973,7 +1973,7 @@ function getTestsReport(ts, runIndex, suiteIndex, options) {
} }
const sections = []; const sections = [];
const tsName = ts.name; const tsName = ts.name;
const tsSlug = makeSuiteSlug(runIndex, suiteIndex); const tsSlug = makeSuiteSlug(runIndex, suiteIndex, options);
const tsNameLink = `<a id="${tsSlug.id}" href="${options.baseUrl + tsSlug.link}">${tsName}</a>`; const tsNameLink = `<a id="${tsSlug.id}" href="${options.baseUrl + tsSlug.link}">${tsName}</a>`;
const icon = getResultIcon(ts.result); const icon = getResultIcon(ts.result);
sections.push(`### ${icon}\xa0${tsNameLink}`); sections.push(`### ${icon}\xa0${tsNameLink}`);
@ -1999,13 +1999,13 @@ function getTestsReport(ts, runIndex, suiteIndex, options) {
sections.push('```'); sections.push('```');
return sections; return sections;
} }
function makeRunSlug(runIndex) { function makeRunSlug(runIndex, options) {
// use prefix to avoid slug conflicts after escaping the paths // use prefix to avoid slug conflicts after escaping the paths
return (0, slugger_1.slug)(`r${runIndex}`); return (0, slugger_1.slug)(`r${runIndex}`, options);
} }
function makeSuiteSlug(runIndex, suiteIndex) { function makeSuiteSlug(runIndex, suiteIndex, options) {
// use prefix to avoid slug conflicts after escaping the paths // use prefix to avoid slug conflicts after escaping the paths
return (0, slugger_1.slug)(`r${runIndex}s${suiteIndex}`); return (0, slugger_1.slug)(`r${runIndex}s${suiteIndex}`, options);
} }
function getResultIcon(result) { function getResultIcon(result) {
switch (result) { switch (result) {
@ -2544,17 +2544,15 @@ function getBasePath(path, trackedFiles) {
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.slug = slug; exports.slug = slug;
// Returns HTML element id and href link usable as manual anchor links function slug(name, options) {
// This is needed because Github in check run summary doesn't automatically
// create links out of headings as it normally does for other markdown content
function slug(name) {
const slugId = name const slugId = name
.trim() .trim()
.replace(/_/g, '') .replace(/_/g, '')
.replace(/[./\\]/g, '-') .replace(/[./\\]/g, '-')
.replace(/[^\w-]/g, ''); .replace(/[^\w-]/g, '');
const id = `user-content-${slugId}`; const id = `user-content-${slugId}`;
const link = `#${slugId}`; // When using the Action Summary for display, links must include the "user-content-" prefix.
const link = options.useActionsSummary ? `#${id}` : `#${slugId}`;
return { id, link }; return { id, link };
} }