Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/lib/pr-preview.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ describe('PR comment preview reconciliation', () => {
});
expect(args).toContain('--jobs');
expect(result.body).toContain(
'Not run on this PR: add `ci:run-rtl` to run it.',
'Not run on this PR: add `ci:run-rtl` for RTL.',
);
});
});
Expand Down
18 changes: 9 additions & 9 deletions .github/scripts/lib/pr-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,11 +477,11 @@ function notRunLine({jobs, a11yReport, visualVerdict, touched = null}) {
return false;
});
if (notRun.length === 0) return '';
const labels = notRun.map(suite => `\`${SUITE_LABELS[suite.id]}\``);
const list =
labels.length === 1
? labels[0]
: `${labels.slice(0, -1).join(', ')} or ${labels.at(-1)}`;
// Each label runs only its own suite, so each names the suite it runs.
const labels = notRun.map(
suite => `\`${SUITE_LABELS[suite.id]}\` for ${suite.label}`,
);
const list = labels.join(', ');
// Too wide for the touched-components check: it says so, and names only
// the suites that did not run. A narrower change's touched components were
// checked, so the labels run the full suites.
Expand All @@ -500,7 +500,7 @@ function notRunLine({jobs, a11yReport, visualVerdict, touched = null}) {
', ',
)}${foundations.length > 3 ? `, and ${foundations.length - 3} more` : ''})`
: `Wide change (${num(touched.componentCount)} components)`;
return `${why}: add ${list} to run ${labels.length === 1 ? 'it' : 'them'}.\n\n`;
return `${why}: add ${list}.\n\n`;
}
// Claim the touched check only when it produced a result.
const checked = (touched?.components || []).some(component =>
Expand All @@ -509,10 +509,10 @@ function notRunLine({jobs, a11yReport, visualVerdict, touched = null}) {
),
);
if (touched && checked)
return `Touched components checked; add ${list} to run the full suite${labels.length === 1 ? '' : 's'}.\n\n`;
return `Touched components checked; for the full suite${labels.length === 1 ? '' : 's'}, add ${list}.\n\n`;
if (touched)
return `Touched components identified; checks did not run. Add ${list} to run ${labels.length === 1 ? 'it' : 'them'}.\n\n`;
return `Not run on this PR: add ${list} to run ${labels.length === 1 ? 'it' : 'them'}.\n\n`;
return `Touched components identified; checks did not run. Add ${list}.\n\n`;
return `Not run on this PR: add ${list}.\n\n`;
}

// The API report step's own renderer (scripts/api-report/changes.mjs), so
Expand Down
16 changes: 8 additions & 8 deletions .github/scripts/lib/pr-status.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ describe('notRunLine', () => {
{name: 'pr-a11y', conclusion: 'success'},
],
}),
).toBe('Not run on this PR: add `ci:run-rtl` to run it.\n\n');
).toBe('Not run on this PR: add `ci:run-rtl` for RTL.\n\n');
});

it('names several suites in one line', () => {
Expand All @@ -609,7 +609,7 @@ describe('notRunLine', () => {
],
}),
).toBe(
'Not run on this PR: add `ci:run-visual`, `ci:run-a11y` or `ci:run-rtl` to run them.\n\n',
'Not run on this PR: add `ci:run-visual` for Visual, `ci:run-a11y` for Accessibility, `ci:run-rtl` for RTL.\n\n',
);
});

Expand All @@ -625,7 +625,7 @@ describe('notRunLine', () => {
touched: wide,
}),
).toBe(
'Wide change (60 components): add `ci:run-visual` or `ci:run-rtl` to run them.\n\n',
'Wide change (60 components): add `ci:run-visual` for Visual, `ci:run-rtl` for RTL.\n\n',
);
expect(notRunLine({jobs: [], touched: wide})).toBe('');
});
Expand All @@ -640,7 +640,7 @@ describe('notRunLine', () => {
{name: 'pr-rtl', conclusion: 'success'},
],
}),
).toBe('Not run on this PR: add `ci:run-visual` to run it.\n\n');
).toBe('Not run on this PR: add `ci:run-visual` for Visual.\n\n');
});

it('says the touched components were checked on a narrow change', () => {
Expand All @@ -663,7 +663,7 @@ describe('notRunLine', () => {
},
}),
).toBe(
'Touched components checked; add `ci:run-visual`, `ci:run-a11y` or `ci:run-rtl` to run the full suites.\n\n',
'Touched components checked; for the full suites, add `ci:run-visual` for Visual, `ci:run-a11y` for Accessibility, `ci:run-rtl` for RTL.\n\n',
);
// Every result not-run: never claim a check that did not happen.
expect(
Expand All @@ -685,7 +685,7 @@ describe('notRunLine', () => {
},
}),
).toBe(
'Touched components identified; checks did not run. Add `ci:run-rtl` to run it.\n\n',
'Touched components identified; checks did not run. Add `ci:run-rtl` for RTL.\n\n',
);
});

Expand All @@ -705,7 +705,7 @@ describe('notRunLine', () => {
},
}),
).toBe(
'Wide change (shared styles: packages/core/src/theme/tokens.stylex.ts): add `ci:run-visual`, `ci:run-a11y` or `ci:run-rtl` to run them.\n\n',
'Wide change (shared styles: packages/core/src/theme/tokens.stylex.ts): add `ci:run-visual` for Visual, `ci:run-a11y` for Accessibility, `ci:run-rtl` for RTL.\n\n',
);
});

Expand All @@ -724,7 +724,7 @@ describe('notRunLine', () => {
it('says nothing when every suite ran, and falls back to the reports without a job list', () => {
expect(notRunLine({jobs: []})).toBe('');
expect(notRunLine({jobs: null, a11yReport: {components: {}}})).toBe(
'Not run on this PR: add `ci:run-visual` to run it.\n\n',
'Not run on this PR: add `ci:run-visual` for Visual.\n\n',
);
});
});
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/touched-components.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ export function summaryMarkdown(report) {
report.foundations?.length > 0
? `it changes shared styles (${report.foundations.join(', ')})`
: `it touches ${report.componentCount} components (more than ${MAX_TOUCHED_COMPONENTS})`;
return `### Touched components\n\nWide change (${report.componentCount} components): the touched-components check did not run because ${reason}. Add \`ci:run-visual\`, \`ci:run-a11y\` or \`ci:run-rtl\` to run the full suite.\n`;
return `### Touched components\n\nWide change (${report.componentCount} components): the touched-components check did not run because ${reason}. Each label runs only its own full suite: \`ci:run-visual\` for Visual, \`ci:run-a11y\` for Accessibility, \`ci:run-rtl\` for RTL.\n`;
Comment thread
astracat-bot[bot] marked this conversation as resolved.
Resolved
}
if (report.components.length === 0) {
return '### Touched components\n\nNo component changed.\n';
Expand All @@ -539,7 +539,7 @@ export function summaryMarkdown(report) {
if (report.broad) {
lines.push(
'',
'This change reaches shared code the analysis could not scope; only the touched components were audited. Add `ci:run-visual`, `ci:run-a11y` or `ci:run-rtl` to audit everything it reaches.',
'This change reaches shared code the analysis could not scope; only the touched components were audited. To audit everything it reaches, add `ci:run-visual` for Visual, `ci:run-a11y` for Accessibility, `ci:run-rtl` for RTL.',
);
}
return `${lines.join('\n')}\n`;
Expand Down
17 changes: 17 additions & 0 deletions .github/scripts/touched-components.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,23 @@ describe('wide changes', () => {
expect(summaryMarkdown(report)).toContain('Wide change (6 components)');
expect(summaryMarkdown(report)).toContain('`ci:run-visual`');
});

it('pairs each label with the one suite it runs, so no label reads as running the visual suite', () => {
const scope = owners(9);
const text = summaryMarkdown(
wideReport({
headSha: 'abc',
scope,
decision: decideWideChange(scope, []),
}),
);
expect(text).toContain(
'Each label runs only its own full suite: `ci:run-visual` for Visual, `ci:run-a11y` for Accessibility, `ci:run-rtl` for RTL.',
);
expect(text).not.toMatch(
/`ci:run-a11y` or `ci:run-rtl` to run the full suite/,
);
});
});

describe('per-component results', () => {
Expand Down