diff --git a/__tests__/report/get-report.test.ts b/__tests__/report/get-report.test.ts index 182469e..560f849 100644 --- a/__tests__/report/get-report.test.ts +++ b/__tests__/report/get-report.test.ts @@ -207,7 +207,7 @@ describe('getReport', () => { 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, { ...DEFAULT_OPTIONS, listFiles: 'none', @@ -217,7 +217,7 @@ describe('getReport', () => { }) 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('failing-file.spec.ts') expect(report).not.toContain('passing-with-skipped-file.spec.ts') diff --git a/dist/index.js b/dist/index.js index 576e7ab..2847890 100644 --- a/dist/index.js +++ b/dist/index.js @@ -57081,20 +57081,20 @@ function getTestRunsReport(testRuns, options) { : options.listFiles === 'none' ? [] : testRuns; - if (filteredTestRuns.length > 0 || options.onlySummary) { - const tableData = filteredTestRuns - .map((tr, originalIndex) => ({ tr, originalIndex })) - .filter(({ tr }) => tr.passed > 0 || tr.failed > 0 || tr.skipped > 0) - .map(({ tr, originalIndex }) => { - const time = formatTime(tr.time); - const name = tr.path; - const addr = options.baseUrl + makeRunSlug(originalIndex, options).link; - const nameLink = markdown_utils_link(name, addr); - const passed = tr.passed > 0 ? `${tr.passed} ${Icon.success}` : ''; - const failed = tr.failed > 0 ? `${tr.failed} ${Icon.fail}` : ''; - const skipped = tr.skipped > 0 ? `${tr.skipped} ${Icon.skip}` : ''; - return [nameLink, passed, failed, skipped, time]; - }); + const tableData = filteredTestRuns + .map((tr, originalIndex) => ({ tr, originalIndex })) + .filter(({ tr }) => tr.passed > 0 || tr.failed > 0 || tr.skipped > 0) + .map(({ tr, originalIndex }) => { + const time = formatTime(tr.time); + const name = tr.path; + const addr = options.baseUrl + makeRunSlug(originalIndex, options).link; + const nameLink = markdown_utils_link(name, addr); + const passed = tr.passed > 0 ? `${tr.passed} ${Icon.success}` : ''; + const failed = tr.failed > 0 ? `${tr.failed} ${Icon.fail}` : ''; + const skipped = tr.skipped > 0 ? `${tr.skipped} ${Icon.skip}` : ''; + 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); sections.push(resultsTable); } diff --git a/src/report/get-report.ts b/src/report/get-report.ts index 52f8645..cac5596 100644 --- a/src/report/get-report.ts +++ b/src/report/get-report.ts @@ -183,21 +183,21 @@ function getTestRunsReport(testRuns: TestRunResult[], options: ReportOptions): s ? [] : testRuns - if (filteredTestRuns.length > 0 || options.onlySummary) { - const tableData = filteredTestRuns - .map((tr, originalIndex) => ({tr, originalIndex})) - .filter(({tr}) => tr.passed > 0 || tr.failed > 0 || tr.skipped > 0) - .map(({tr, originalIndex}) => { - const time = formatTime(tr.time) - const name = tr.path - const addr = options.baseUrl + makeRunSlug(originalIndex, options).link - const nameLink = link(name, addr) - const passed = tr.passed > 0 ? `${tr.passed} ${Icon.success}` : '' - const failed = tr.failed > 0 ? `${tr.failed} ${Icon.fail}` : '' - const skipped = tr.skipped > 0 ? `${tr.skipped} ${Icon.skip}` : '' - return [nameLink, passed, failed, skipped, time] - }) + const tableData = filteredTestRuns + .map((tr, originalIndex) => ({tr, originalIndex})) + .filter(({tr}) => tr.passed > 0 || tr.failed > 0 || tr.skipped > 0) + .map(({tr, originalIndex}) => { + const time = formatTime(tr.time) + const name = tr.path + const addr = options.baseUrl + makeRunSlug(originalIndex, options).link + const nameLink = link(name, addr) + const passed = tr.passed > 0 ? `${tr.passed} ${Icon.success}` : '' + const failed = tr.failed > 0 ? `${tr.failed} ${Icon.fail}` : '' + const skipped = tr.skipped > 0 ? `${tr.skipped} ${Icon.skip}` : '' + 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],