mirror of
https://github.com/dorny/test-reporter.git
synced 2026-05-06 10:37:36 +02:00
Resolve list-files conflicts on current main
This commit is contained in:
parent
ba6f1d11e2
commit
45c8d46681
4 changed files with 37 additions and 11 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import {DEFAULT_OPTIONS, getBadge, getReport, ReportOptions} from '../../src/report/get-report.js'
|
import {DEFAULT_OPTIONS, getBadge, getReport, ReportOptions} from '../../src/report/get-report.js'
|
||||||
import {TestCaseResult, TestGroupResult, TestRunResult, TestSuiteResult} from '../../src/test-results'
|
import {TestCaseResult, TestGroupResult, TestRunResult, TestSuiteResult} from '../../src/test-results.js'
|
||||||
|
|
||||||
describe('getBadge', () => {
|
describe('getBadge', () => {
|
||||||
describe('URI encoding with special characters', () => {
|
describe('URI encoding with special characters', () => {
|
||||||
|
|
@ -141,10 +141,12 @@ describe('getReport', () => {
|
||||||
tests.push(new TestCaseResult(`passed-test-${i}`, 'success', 100))
|
tests.push(new TestCaseResult(`passed-test-${i}`, 'success', 100))
|
||||||
}
|
}
|
||||||
for (let i = 0; i < failed; i++) {
|
for (let i = 0; i < failed; i++) {
|
||||||
tests.push(new TestCaseResult(`failed-test-${i}`, 'failed', 100, {
|
tests.push(
|
||||||
|
new TestCaseResult(`failed-test-${i}`, 'failed', 100, {
|
||||||
details: 'Test failed',
|
details: 'Test failed',
|
||||||
message: 'Assertion error'
|
message: 'Assertion error'
|
||||||
}))
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
for (let i = 0; i < skipped; i++) {
|
for (let i = 0; i < skipped; i++) {
|
||||||
tests.push(new TestCaseResult(`skipped-test-${i}`, 'skipped', 0))
|
tests.push(new TestCaseResult(`skipped-test-${i}`, 'skipped', 0))
|
||||||
|
|
|
||||||
22
dist/index.js
generated
vendored
22
dist/index.js
generated
vendored
|
|
@ -56954,6 +56954,7 @@ const DEFAULT_OPTIONS = {
|
||||||
listSuites: 'all',
|
listSuites: 'all',
|
||||||
listTests: 'all',
|
listTests: 'all',
|
||||||
slugPrefix: '',
|
slugPrefix: '',
|
||||||
|
listFiles: 'all',
|
||||||
baseUrl: '',
|
baseUrl: '',
|
||||||
onlySummary: false,
|
onlySummary: false,
|
||||||
useActionsSummary: true,
|
useActionsSummary: true,
|
||||||
|
|
@ -57074,8 +57075,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 }) => {
|
||||||
|
|
@ -57092,7 +57099,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) {
|
||||||
|
|
@ -58949,6 +58956,7 @@ class TestReporter {
|
||||||
reporter = getInput('reporter', { required: true });
|
reporter = getInput('reporter', { required: true });
|
||||||
listSuites = getInput('list-suites', { required: true });
|
listSuites = getInput('list-suites', { required: true });
|
||||||
listTests = getInput('list-tests', { required: true });
|
listTests = getInput('list-tests', { required: true });
|
||||||
|
listFiles = getInput('list-files', { required: true });
|
||||||
maxAnnotations = parseInt(getInput('max-annotations', { required: true }));
|
maxAnnotations = parseInt(getInput('max-annotations', { required: true }));
|
||||||
failOnError = getInput('fail-on-error', { required: true }) === 'true';
|
failOnError = getInput('fail-on-error', { required: true }) === 'true';
|
||||||
failOnEmpty = getInput('fail-on-empty', { required: true }) === 'true';
|
failOnEmpty = getInput('fail-on-empty', { required: true }) === 'true';
|
||||||
|
|
@ -58972,6 +58980,10 @@ class TestReporter {
|
||||||
setFailed(`Input parameter 'list-tests' has invalid value`);
|
setFailed(`Input parameter 'list-tests' has invalid value`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (this.listFiles !== 'all' && this.listFiles !== 'failed' && this.listFiles !== 'none') {
|
||||||
|
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') {
|
||||||
setFailed(`Input parameter 'collapsed' has invalid value`);
|
setFailed(`Input parameter 'collapsed' has invalid value`);
|
||||||
return;
|
return;
|
||||||
|
|
@ -59056,7 +59068,7 @@ class TestReporter {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const { listSuites, listTests, slugPrefix, onlySummary, useActionsSummary, badgeTitle, reportTitle, collapsed } = this;
|
const { listSuites, listTests, slugPrefix, 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);
|
||||||
|
|
@ -59067,6 +59079,7 @@ class TestReporter {
|
||||||
listSuites,
|
listSuites,
|
||||||
listTests,
|
listTests,
|
||||||
slugPrefix,
|
slugPrefix,
|
||||||
|
listFiles,
|
||||||
baseUrl,
|
baseUrl,
|
||||||
onlySummary,
|
onlySummary,
|
||||||
useActionsSummary,
|
useActionsSummary,
|
||||||
|
|
@ -59096,6 +59109,7 @@ class TestReporter {
|
||||||
listSuites,
|
listSuites,
|
||||||
listTests,
|
listTests,
|
||||||
slugPrefix,
|
slugPrefix,
|
||||||
|
listFiles,
|
||||||
baseUrl,
|
baseUrl,
|
||||||
onlySummary,
|
onlySummary,
|
||||||
useActionsSummary,
|
useActionsSummary,
|
||||||
|
|
|
||||||
12
src/main.ts
12
src/main.ts
|
|
@ -183,7 +183,17 @@ class TestReporter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const {listSuites, listTests, slugPrefix, listFiles, onlySummary, useActionsSummary, badgeTitle, reportTitle, collapsed} = this
|
const {
|
||||||
|
listSuites,
|
||||||
|
listTests,
|
||||||
|
slugPrefix,
|
||||||
|
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)
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ const MAX_ACTIONS_SUMMARY_LENGTH = 1048576
|
||||||
export interface ReportOptions {
|
export interface ReportOptions {
|
||||||
listSuites: 'all' | 'failed' | 'none'
|
listSuites: 'all' | 'failed' | 'none'
|
||||||
listTests: 'all' | 'failed' | 'none'
|
listTests: 'all' | 'failed' | 'none'
|
||||||
slugPrefix: string;
|
slugPrefix: string
|
||||||
listFiles: 'all' | 'failed' | 'none'
|
listFiles: 'all' | 'failed' | 'none'
|
||||||
baseUrl: string
|
baseUrl: string
|
||||||
onlySummary: boolean
|
onlySummary: boolean
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue