Skip to content

Commit

Permalink
- Add new config to hide the verbose information on no test suite ava…
Browse files Browse the repository at this point in the history
…ilable

  - FIXES #1287 partially
  • Loading branch information
mikepenz committed Jan 26, 2025
1 parent 3eb7372 commit 4c1397a
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 10 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ jobs:
| `transformers` | Optional. Array of `Transformer`s offering the ability to adjust the fileName. Defaults to: `[{"searchValue":"::","replaceValue":"/"}]` |
| `job_summary` | Optional. Enables the publishing of the job summary for the results. Defaults to `true`. May be required to disable [Enterprise Server](https://github.com/mikepenz/action-junit-report/issues/637) |
| `detailed_summary` | Optional. Include table with all test results in the summary. Defaults to `false`. |
| `flaky_summary` | Optional. Include table with all falky results in the summary. Defaults to `false`. |
| `flaky_summary` | Optional. Include table with all flaky results in the summary. Defaults to `false`. |
| `verbose_summary` | Optional. Detail table will note if there were no test annotations for a test suite. Defaults to `true`. |
| `group_suite` | Optional. If enabled, will group the testcases by test suite in the `detailed_summary`. Defaults to `false`. |
| `comment` | Optional. Enables a comment being added to the PR with the summary tables (Respects the summary configuration flags). Defaults to `false`. |
| `updateComment` | Optional. If a prior action run comment exists, it is updated. If disabled, new comments are creted for each run. Defaults to `true`. |
Expand Down
4 changes: 2 additions & 2 deletions __tests__/table.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('buildSummaryTables', () => {
'/'
)

const [table, detailTable, flakyTable] = buildSummaryTables([testResult], true, true, true)
const [table, detailTable, flakyTable] = buildSummaryTables([testResult], true, true, true, true)

expect(table).toStrictEqual(NORMAL_TABLE)
expect(detailTable).toStrictEqual([
Expand Down Expand Up @@ -100,7 +100,7 @@ describe('buildSummaryTables', () => {
'/'
)

const [table, detailTable, flakyTable] = buildSummaryTables([testResult], true, true, true, true)
const [table, detailTable, flakyTable] = buildSummaryTables([testResult], true, true, true, true, true)

expect(table).toStrictEqual(NORMAL_TABLE)
expect(detailTable).toStrictEqual([
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ inputs:
description: 'Include table with all flaky results in summary'
required: false
default: 'false'
verbose_summary:
description: 'Include note of missing test annotations in summary.'
required: false
default: 'true'
group_suite:
description: 'If enabled, will group the testcases by test suite in the `detailed_summary`'
required: false
Expand Down
11 changes: 7 additions & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/annotator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export async function attachComment(
const identifier = buildCommentIdentifier(checkName)

let comment = buildTable(table)
if (detailsTable.length > 0) {
if (detailsTable.length > 1) {
comment += '\n\n'
comment += buildTable(detailsTable)
}
Expand Down
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export async function run(): Promise<void> {
const jobSummary = core.getInput('job_summary') === 'true'
const detailedSummary = core.getInput('detailed_summary') === 'true'
const flakySummary = core.getInput('flaky_summary') === 'true'
const verboseSummary = core.getInput('verbose_summary') === 'true'
const groupSuite = core.getInput('group_suite') === 'true'
const comment = core.getInput('comment') === 'true'
const updateComment = core.getInput('updateComment') === 'true'
Expand Down Expand Up @@ -155,6 +156,7 @@ export async function run(): Promise<void> {
includePassed,
detailedSummary,
flakySummary,
verboseSummary,
groupSuite
)
if (jobSummary && supportsJobSummary) {
Expand Down
5 changes: 4 additions & 1 deletion src/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export function buildSummaryTables(
includePassed: boolean,
detailedSummary: boolean,
flakySummary: boolean,
verboseSummary: boolean,
groupSuite = false
): [SummaryTableRow[], SummaryTableRow[], SummaryTableRow[]] {
// only include a warning icon if there are skipped tests
Expand Down Expand Up @@ -67,7 +68,9 @@ export function buildSummaryTables(
`⚠️ No annotations found for ${testResult.checkName}. If you want to include passed results in this table please configure 'include_passed' as 'true'`
)
}
detailsTable.push([{data: `No test annotations available`, colspan: '2'}])
if (verboseSummary) {
detailsTable.push([{data: `No test annotations available`, colspan: '2'}])
}
} else {
if (detailedSummary) {
detailsTable.push([{data: `<strong>${testResult.checkName}</strong>`, colspan: '2'}])
Expand Down

0 comments on commit 4c1397a

Please sign in to comment.