perf-budgets reports only for a project that runs Playwright (a new starter site has no e2e yet)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
3b32e659c5
commit
6b16b9f933
@@ -145,6 +145,10 @@ export const performanceRules: DoctorRule[] = [
|
||||
// A budget nobody runs is a wish: the gate test fails when a change makes the site slower
|
||||
id: 'perf-budgets',
|
||||
check: (ctx) => {
|
||||
// only a project that already runs browser tests: there the budget test is one file to copy (a new site from the
|
||||
// starter has none yet — AGENT.md §11 and the iapl-performance skill bring it in with the first e2e tests)
|
||||
const playwright = !!ctx.installed('@playwright/test') || ['playwright.config.ts', 'playwright.config.js', 'playwright.config.mjs'].some((f) => ctx.exists(f))
|
||||
if (!playwright) {return []}
|
||||
const dirs = ['e2e', 'tests', 'test'].filter((d) => ctx.exists(d))
|
||||
const has = dirs.some((d) => ctx.list(d).some((name) => /perf/i.test(name) || /\bperfBudgets\s*\(|\boverBudget\s*\(/.test(ctx.read(`${d}/${name}`))))
|
||||
return has ? [] : [{ fix: 'copy the iapl-performance skill\'s resources/performance.spec.template.ts to e2e/ (budgets from perfBudgets())', message: 'no performance budget test: nothing fails when a change makes the site slower', severity: 'info' }]
|
||||
|
||||
Reference in New Issue
Block a user