mirror of
https://github.com/dorny/test-reporter.git
synced 2026-02-04 05:27:55 +01:00
Rebuild dist with list-files parameter
This commit is contained in:
parent
20f3d370e2
commit
f192fb715b
1 changed files with 18 additions and 4 deletions
22
dist/index.js
generated
vendored
22
dist/index.js
generated
vendored
|
|
@ -302,6 +302,7 @@ class TestReporter {
|
||||||
reporter = core.getInput('reporter', { required: true });
|
reporter = core.getInput('reporter', { required: true });
|
||||||
listSuites = core.getInput('list-suites', { required: true });
|
listSuites = core.getInput('list-suites', { required: true });
|
||||||
listTests = core.getInput('list-tests', { required: true });
|
listTests = core.getInput('list-tests', { required: true });
|
||||||
|
listFiles = core.getInput('list-files', { required: true });
|
||||||
maxAnnotations = parseInt(core.getInput('max-annotations', { required: true }));
|
maxAnnotations = parseInt(core.getInput('max-annotations', { required: true }));
|
||||||
failOnError = core.getInput('fail-on-error', { required: true }) === 'true';
|
failOnError = core.getInput('fail-on-error', { required: true }) === 'true';
|
||||||
failOnEmpty = core.getInput('fail-on-empty', { required: true }) === 'true';
|
failOnEmpty = core.getInput('fail-on-empty', { required: true }) === 'true';
|
||||||
|
|
@ -324,6 +325,10 @@ class TestReporter {
|
||||||
core.setFailed(`Input parameter 'list-tests' has invalid value`);
|
core.setFailed(`Input parameter 'list-tests' has invalid value`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (this.listFiles !== 'all' && this.listFiles !== 'failed' && this.listFiles !== 'none') {
|
||||||
|
core.setFailed(`Input parameter 'list-files' has invalid value`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (this.collapsed !== 'auto' && this.collapsed !== 'always' && this.collapsed !== 'never') {
|
if (this.collapsed !== 'auto' && this.collapsed !== 'always' && this.collapsed !== 'never') {
|
||||||
core.setFailed(`Input parameter 'collapsed' has invalid value`);
|
core.setFailed(`Input parameter 'collapsed' has invalid value`);
|
||||||
return;
|
return;
|
||||||
|
|
@ -407,7 +412,7 @@ class TestReporter {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const { listSuites, listTests, onlySummary, useActionsSummary, badgeTitle, reportTitle, collapsed } = this;
|
const { listSuites, listTests, listFiles, onlySummary, useActionsSummary, badgeTitle, reportTitle, collapsed } = this;
|
||||||
const passed = results.reduce((sum, tr) => sum + tr.passed, 0);
|
const passed = results.reduce((sum, tr) => sum + tr.passed, 0);
|
||||||
const failed = results.reduce((sum, tr) => sum + tr.failed, 0);
|
const failed = results.reduce((sum, tr) => sum + tr.failed, 0);
|
||||||
const skipped = results.reduce((sum, tr) => sum + tr.skipped, 0);
|
const skipped = results.reduce((sum, tr) => sum + tr.skipped, 0);
|
||||||
|
|
@ -417,6 +422,7 @@ class TestReporter {
|
||||||
const summary = (0, get_report_1.getReport)(results, {
|
const summary = (0, get_report_1.getReport)(results, {
|
||||||
listSuites,
|
listSuites,
|
||||||
listTests,
|
listTests,
|
||||||
|
listFiles,
|
||||||
baseUrl,
|
baseUrl,
|
||||||
onlySummary,
|
onlySummary,
|
||||||
useActionsSummary,
|
useActionsSummary,
|
||||||
|
|
@ -445,6 +451,7 @@ class TestReporter {
|
||||||
const summary = (0, get_report_1.getReport)(results, {
|
const summary = (0, get_report_1.getReport)(results, {
|
||||||
listSuites,
|
listSuites,
|
||||||
listTests,
|
listTests,
|
||||||
|
listFiles,
|
||||||
baseUrl,
|
baseUrl,
|
||||||
onlySummary,
|
onlySummary,
|
||||||
useActionsSummary,
|
useActionsSummary,
|
||||||
|
|
@ -1949,6 +1956,7 @@ const MAX_ACTIONS_SUMMARY_LENGTH = 1048576;
|
||||||
exports.DEFAULT_OPTIONS = {
|
exports.DEFAULT_OPTIONS = {
|
||||||
listSuites: 'all',
|
listSuites: 'all',
|
||||||
listTests: 'all',
|
listTests: 'all',
|
||||||
|
listFiles: 'all',
|
||||||
baseUrl: '',
|
baseUrl: '',
|
||||||
onlySummary: false,
|
onlySummary: false,
|
||||||
useActionsSummary: true,
|
useActionsSummary: true,
|
||||||
|
|
@ -2069,8 +2077,14 @@ function getTestRunsReport(testRuns, options) {
|
||||||
sections.push(`<details><summary>Expand for details</summary>`);
|
sections.push(`<details><summary>Expand for details</summary>`);
|
||||||
sections.push(` `);
|
sections.push(` `);
|
||||||
}
|
}
|
||||||
if (testRuns.length > 0 || options.onlySummary) {
|
// Filter test runs based on list-files option
|
||||||
const tableData = testRuns
|
const filteredTestRuns = options.listFiles === 'failed'
|
||||||
|
? testRuns.filter(tr => tr.result === 'failed')
|
||||||
|
: options.listFiles === 'none'
|
||||||
|
? []
|
||||||
|
: testRuns;
|
||||||
|
if (filteredTestRuns.length > 0 || options.onlySummary) {
|
||||||
|
const tableData = filteredTestRuns
|
||||||
.map((tr, originalIndex) => ({ tr, originalIndex }))
|
.map((tr, originalIndex) => ({ tr, originalIndex }))
|
||||||
.filter(({ tr }) => tr.passed > 0 || tr.failed > 0 || tr.skipped > 0)
|
.filter(({ tr }) => tr.passed > 0 || tr.failed > 0 || tr.skipped > 0)
|
||||||
.map(({ tr, originalIndex }) => {
|
.map(({ tr, originalIndex }) => {
|
||||||
|
|
@ -2087,7 +2101,7 @@ function getTestRunsReport(testRuns, options) {
|
||||||
sections.push(resultsTable);
|
sections.push(resultsTable);
|
||||||
}
|
}
|
||||||
if (options.onlySummary === false) {
|
if (options.onlySummary === false) {
|
||||||
const suitesReports = testRuns.map((tr, i) => getSuitesReport(tr, i, options)).flat();
|
const suitesReports = filteredTestRuns.map((tr, i) => getSuitesReport(tr, i, options)).flat();
|
||||||
sections.push(...suitesReports);
|
sections.push(...suitesReports);
|
||||||
}
|
}
|
||||||
if (shouldCollapse) {
|
if (shouldCollapse) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue