1
0
Fork 0

test(audit): support exact route filtering in the mobile audit

AUDIT_ROUTE_FILTER now accepts "=/route" for an exact match in addition to
the existing substring match, so a single route such as the dashboard can be
audited on its own without pulling in every route that contains the filter.
This commit is contained in:
Jason Fraley 2026-10-13 10:38:45 -04:00
parent 9bfe43ad71
commit 2a264a4530

View file

@ -14,6 +14,7 @@
* Usage: bun run tests/audit/mobile-audit.ts
* Env: AUDIT_BASE_URL (default http://localhost:3000)
* AUDIT_USER / AUDIT_PASS (default dev / Test123)
* AUDIT_ROUTE_FILTER (substring match, or "=/route" for an exact match)
* E2E_BROWSER_PATH (browser executable override)
*
* Outputs tests/audit/mobile-audit-report.json (regression gate artifact for
@ -417,7 +418,11 @@ async function main() {
routes.push(`/wiki/category/${encodeURIComponent(category || "general")}`);
console.log(`Auditing ${routes.length} routes at ${VIEWPORT.width}x${VIEWPORT.height} against ${BASE_URL}`);
const auditedRoutes = ROUTE_FILTER ? routes.filter((r) => r.includes(ROUTE_FILTER)) : routes;
const auditedRoutes = ROUTE_FILTER
? routes.filter((r) =>
ROUTE_FILTER.startsWith("=") ? r === ROUTE_FILTER.slice(1) : r.includes(ROUTE_FILTER),
)
: routes;
if (ROUTE_FILTER) {
// Targeted run: drop pre-seeded skips that did not match the filter.
results.length = 0;