Skip to content

Commit bc63127

Browse files
committed
add stats to the table
1 parent ad76987 commit bc63127

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
// TODO:
2+
1

src/index.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export const generateSummaryMarkdownTable = (
3030
remoteHref?: string;
3131
}>,
3232
): string => {
33-
const header = `| | Name | Duration | Report |`;
34-
const delimiter = `|-|-|-|-|`;
33+
const header = `| | Name | Duration | Stats | Report |`;
34+
const delimiter = `|-|-|-|-|-|`;
3535
const rows = summaries.map((summary) => {
3636
const stats = {
3737
unknown: summary.stats.unknown ?? 0,
@@ -44,12 +44,19 @@ export const generateSummaryMarkdownTable = (
4444
const img = `<img src="https://allurecharts.qameta.workers.dev/pie?passed=${stats.passed}&failed=${stats.failed}&broken=${stats.broken}&skipped=${stats.skipped}&unknown=${stats.unknown}&size=32" width="28px" height="28px" />`;
4545
const name = summary.name;
4646
const duration = formatDuration(summary.duration);
47+
const statsLabels = [
48+
`<img alt="Passed tests" src="https://allurecharts.qameta.workers.dev/dot?type=passed&size=8" />&nbsp;<span>${stats.passed}</span>`,
49+
`<img alt="Failed tests" src="https://allurecharts.qameta.workers.dev/dot?type=failed&size=8" />&nbsp;<span>${stats.failed}</span>`,
50+
`<img alt="Broken tests" src="https://allurecharts.qameta.workers.dev/dot?type=broken&size=8" />&nbsp;<span>${stats.broken}</span>`,
51+
`<img alt="Skipped tests" src="https://allurecharts.qameta.workers.dev/dot?type=skipped&size=8" />&nbsp;<span>${stats.skipped}</span>`,
52+
`<img alt="Unknown tests" src="https://allurecharts.qameta.workers.dev/dot?type=unknown&size=8" />&nbsp;<span>${stats.unknown}</span>`,
53+
].join("&nbsp;&nbsp;&nbsp;");
4754
const report = summary.remoteHref ? `[View](${summary.remoteHref})` : "N/A";
4855

49-
return `| ${img} | ${name} | ${duration} | ${report} |`;
56+
return `| ${img} | ${name} | ${duration} | ${statsLabels} | ${report} |`;
5057
});
5158

52-
return [header, delimiter, ...rows].join("\n");
59+
return ["# Allure Report Summary", header, delimiter, ...rows].join("\n");
5360
};
5461

5562
const run = async (): Promise<void> => {

0 commit comments

Comments
 (0)