Skip to content

Commit b7246d1

Browse files
committed
ci(danger): simplify CI naming
1 parent fd6de75 commit b7246d1

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

util/danger/format.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ describe("renderDangerReport", () => {
5454

5555
const output = renderDangerReport(result);
5656

57-
expect(output).toMatch(/\|\s*Source\s*\|\s*\*\*4\*\*\s*\|\s*3\s*\|\s*1\s*\|\s*\*\*1\*\*\s*\|\s*-\s*\|\s*1\s*\|\s*-\s*\|\s*-\s*\|/);
58-
expect(output).toMatch(/\|\s*Tests\s*\|\s*\*\*2\*\*\s*\|\s*2\s*\|\s*-\s*\|\s*\*\*1\*\*\s*\|\s*-\s*\|\s*1\s*\|\s*-\s*\|\s*-\s*\|/);
57+
expect(output).toMatch(/\|\s*🛠 Source\s*\|\s*\*\*4\*\*\s*\|\s*3\s*\|\s*1\s*\|\s*\*\*1\*\*\s*\|\s*-\s*\|\s*1\s*\|\s*-\s*\|\s*-\s*\|/u);
58+
expect(output).toMatch(/\|\s*🧪 Unit Tests\s*\|\s*\*\*2\*\*\s*\|\s*2\s*\|\s*-\s*\|\s*\*\*1\*\*\s*\|\s*-\s*\|\s*1\s*\|\s*-\s*\|\s*-\s*\|/u);
5959
expect(output).toMatch(/\|\s*\*\*Total\*\*\s*\|\s*\*\*6\*\*\s*\|\s*5\s*\|\s*1\s*\|\s*\*\*2\*\*\s*\|/);
6060
expect(output).toContain("## ✨ Highlights");
6161
expect(output.trim().startsWith("> 🚧 Danger.js checks for MrDocs")).toBe(true);
@@ -68,7 +68,7 @@ describe("renderDangerReport", () => {
6868
const result: DangerResult = { warnings: [], infos: [], summary };
6969

7070
const output = renderDangerReport(result);
71-
const sourceRow = output.split("\n").find((line) => line.startsWith("| Source"));
71+
const sourceRow = output.split("\n").find((line) => line.startsWith("| 🛠️ Source"));
7272

7373
expect(sourceRow).toBeDefined();
7474
expect(sourceRow).not.toMatch(/-1/);

util/danger/format.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,37 @@ const notice = "> 🚧 Danger.js checks for MrDocs are experimental; expect some
1313

1414
const scopeLabels: Record<string, string> = {
1515
source: "Source",
16-
tests: "Tests",
16+
tests: "Unit Tests",
1717
"golden-tests": "Golden Tests",
1818
docs: "Docs",
19-
ci: "CI / Roadmap",
19+
ci: "CI",
2020
build: "Build / Toolchain",
2121
tooling: "Tooling",
2222
"third-party": "Third-party",
2323
other: "Other",
2424
};
2525

26+
const scopeEmojis: Record<string, string> = {
27+
source: "🛠️",
28+
tests: "🧪",
29+
"golden-tests": "🥇",
30+
docs: "📄",
31+
ci: "⚙️",
32+
build: "🏗️",
33+
tooling: "🧰",
34+
"third-party": "🤝",
35+
other: "📦",
36+
};
37+
2638
function labelForScope(scope: string): string {
2739
return scopeLabels[scope] ?? scope;
2840
}
2941

42+
function emojiLabelForScope(scope: string): string {
43+
const emoji = scopeEmojis[scope] ?? "❓";
44+
return `${emoji} ${labelForScope(scope)}`;
45+
}
46+
3047
/**
3148
* Pad cells so pipes align in the raw Markdown.
3249
*/
@@ -122,7 +139,7 @@ function renderChangeTable(summary: ScopeReport): string {
122139
const fileDelta = countFileChanges(s);
123140
const churn = scoped.additions + scoped.deletions;
124141
const fileDeltaBold = formatCount(fileDelta); // bold delta
125-
const label = labelForScope(scope);
142+
const label = emojiLabelForScope(scope);
126143
return [
127144
label,
128145
formatCount(churn),

0 commit comments

Comments
 (0)