1
0
Fork 0
mirror of https://github.com/dorny/test-reporter.git synced 2026-03-21 23:52:12 +01:00

feat: added a slug-prefix parameter for link anchors

Motivation: when using a matrix job, or more than one kind of tests in a same workflow, we can end up with multiple summaries at the same time. This will lead to multiple anchors and html id that will no longer be unique.
This prefix option allow to disambiguate those anchors ; and keep them functional.
This commit is contained in:
Thomas Durand 2026-03-05 01:52:45 +01:00
parent 3d76b34a45
commit 7f0723a953
No known key found for this signature in database
GPG key ID: 68F13AD8CF49EEEB
7 changed files with 49 additions and 4 deletions

8
dist/index.js generated vendored
View file

@ -55869,7 +55869,7 @@ function getExceptionSource(stackTrace, trackedFiles, getRelativePath) {
;// CONCATENATED MODULE: ./lib/utils/slugger.js
function slug(name, options) {
const slugId = name
const slugId = `${options.slugPrefix}${name}`
.trim()
.replace(/_/g, '')
.replace(/[./\\]/g, '-')
@ -55891,6 +55891,7 @@ const MAX_ACTIONS_SUMMARY_LENGTH = 1048576;
const DEFAULT_OPTIONS = {
listSuites: 'all',
listTests: 'all',
slugPrefix: '',
baseUrl: '',
onlySummary: false,
useActionsSummary: true,
@ -57890,6 +57891,7 @@ class TestReporter {
workDirInput = getInput('working-directory', { required: false });
onlySummary = getInput('only-summary', { required: false }) === 'true';
useActionsSummary = getInput('use-actions-summary', { required: false }) === 'true';
slugPrefix = getInput('slug-prefix', { required: false });
badgeTitle = getInput('badge-title', { required: false });
reportTitle = getInput('report-title', { required: false });
collapsed = getInput('collapsed', { required: false });
@ -57989,7 +57991,7 @@ class TestReporter {
throw error;
}
}
const { listSuites, listTests, onlySummary, useActionsSummary, badgeTitle, reportTitle, collapsed } = this;
const { listSuites, listTests, slugPrefix, onlySummary, useActionsSummary, badgeTitle, reportTitle, collapsed } = this;
const passed = results.reduce((sum, tr) => sum + tr.passed, 0);
const failed = results.reduce((sum, tr) => sum + tr.failed, 0);
const skipped = results.reduce((sum, tr) => sum + tr.skipped, 0);
@ -57999,6 +58001,7 @@ class TestReporter {
const summary = getReport(results, {
listSuites,
listTests,
slugPrefix,
baseUrl,
onlySummary,
useActionsSummary,
@ -58027,6 +58030,7 @@ class TestReporter {
const summary = getReport(results, {
listSuites,
listTests,
slugPrefix,
baseUrl,
onlySummary,
useActionsSummary,