in action-junit-report/src/annotator.ts [101:159]
export async function attachSummary(
testResults: TestResult[],
detailedSummary: boolean,
includePassed: boolean
): Promise<void> {
const table: SummaryTableRow[] = [
[
{data: '', header: true},
{data: 'Tests', header: true},
{data: 'Passed ✅', header: true},
{data: 'Skipped ↪️', header: true},
{data: 'Failed ❌', header: true}
]
]
const detailsTable: SummaryTableRow[] = [
[
{data: '', header: true},
{data: 'Test', header: true},
{data: 'Result', header: true}
]
]
for (const testResult of testResults) {
table.push([
`${testResult.checkName}`,
`${testResult.totalCount} run`,
`${testResult.passed} passed`,
`${testResult.skipped} skipped`,
`${testResult.failed} failed`
])
if (detailedSummary) {
const annotations = testResult.annotations.filter(
annotation => includePassed || annotation.annotation_level !== 'notice'
)
if (annotations.length === 0) {
core.warning(
`⚠️ No annotations found for ${testResult.checkName}. If you want to include passed results in this table please configure 'include_passed' as 'true'`
)
detailsTable.push([`-`, `No test annotations available`, `-`])
} else {
for (const annotation of annotations) {
detailsTable.push([
`${testResult.checkName}`,
`${annotation.title}`,
`${annotation.annotation_level === 'notice' ? '✅ pass' : `❌ ${annotation.annotation_level}`}`
])
}
}
}
}
await core.summary.addTable(table).write()
if (detailedSummary) {
await core.summary.addTable(detailsTable).write()
}
}