mirror of
https://github.com/dorny/test-reporter.git
synced 2026-05-06 10:37:36 +02:00
Suppress empty list-files summary table
This commit is contained in:
parent
d7f15447e6
commit
e05b863b43
3 changed files with 30 additions and 30 deletions
|
|
@ -207,7 +207,7 @@ describe('getReport', () => {
|
||||||
expect(report).not.toContain('passing-with-skipped-file.spec.ts')
|
expect(report).not.toContain('passing-with-skipped-file.spec.ts')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('shows an empty summary table when list-files is "none" and only-summary is enabled', () => {
|
it('does not show an empty summary table when list-files is "none" and only-summary is enabled', () => {
|
||||||
const report = getReport(results, {
|
const report = getReport(results, {
|
||||||
...DEFAULT_OPTIONS,
|
...DEFAULT_OPTIONS,
|
||||||
listFiles: 'none',
|
listFiles: 'none',
|
||||||
|
|
@ -217,7 +217,7 @@ describe('getReport', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(report).toContain('![')
|
expect(report).toContain('![')
|
||||||
expect(report).toContain('|Report|Passed|Failed|Skipped|Time|')
|
expect(report).not.toContain('|Report|Passed|Failed|Skipped|Time|')
|
||||||
expect(report).not.toContain('passing-file.spec.ts')
|
expect(report).not.toContain('passing-file.spec.ts')
|
||||||
expect(report).not.toContain('failing-file.spec.ts')
|
expect(report).not.toContain('failing-file.spec.ts')
|
||||||
expect(report).not.toContain('passing-with-skipped-file.spec.ts')
|
expect(report).not.toContain('passing-with-skipped-file.spec.ts')
|
||||||
|
|
|
||||||
2
dist/index.js
generated
vendored
2
dist/index.js
generated
vendored
|
|
@ -57081,7 +57081,6 @@ function getTestRunsReport(testRuns, options) {
|
||||||
: options.listFiles === 'none'
|
: options.listFiles === 'none'
|
||||||
? []
|
? []
|
||||||
: testRuns;
|
: testRuns;
|
||||||
if (filteredTestRuns.length > 0 || options.onlySummary) {
|
|
||||||
const tableData = filteredTestRuns
|
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)
|
||||||
|
|
@ -57095,6 +57094,7 @@ function getTestRunsReport(testRuns, options) {
|
||||||
const skipped = tr.skipped > 0 ? `${tr.skipped} ${Icon.skip}` : '';
|
const skipped = tr.skipped > 0 ? `${tr.skipped} ${Icon.skip}` : '';
|
||||||
return [nameLink, passed, failed, skipped, time];
|
return [nameLink, passed, failed, skipped, time];
|
||||||
});
|
});
|
||||||
|
if (tableData.length > 0) {
|
||||||
const resultsTable = table(['Report', 'Passed', 'Failed', 'Skipped', 'Time'], [Align.Left, Align.Right, Align.Right, Align.Right, Align.Right], ...tableData);
|
const resultsTable = table(['Report', 'Passed', 'Failed', 'Skipped', 'Time'], [Align.Left, Align.Right, Align.Right, Align.Right, Align.Right], ...tableData);
|
||||||
sections.push(resultsTable);
|
sections.push(resultsTable);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,6 @@ function getTestRunsReport(testRuns: TestRunResult[], options: ReportOptions): s
|
||||||
? []
|
? []
|
||||||
: testRuns
|
: testRuns
|
||||||
|
|
||||||
if (filteredTestRuns.length > 0 || options.onlySummary) {
|
|
||||||
const tableData = filteredTestRuns
|
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)
|
||||||
|
|
@ -198,6 +197,7 @@ function getTestRunsReport(testRuns: TestRunResult[], options: ReportOptions): s
|
||||||
return [nameLink, passed, failed, skipped, time]
|
return [nameLink, passed, failed, skipped, time]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (tableData.length > 0) {
|
||||||
const resultsTable = table(
|
const resultsTable = table(
|
||||||
['Report', 'Passed', 'Failed', 'Skipped', 'Time'],
|
['Report', 'Passed', 'Failed', 'Skipped', 'Time'],
|
||||||
[Align.Left, Align.Right, Align.Right, Align.Right, Align.Right],
|
[Align.Left, Align.Right, Align.Right, Align.Right, Align.Right],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue