Files
community-rule/tests/e2e/axe.ts
T
2025-08-30 13:46:35 -06:00

15 lines
421 B
TypeScript

import { AxeBuilder } from "@axe-core/playwright";
export async function runA11y(page, options = {}) {
const results = await new AxeBuilder({ page })
.withTags(["wcag2a", "wcag2aa"])
.analyze();
if (results.violations.length > 0) {
console.log("Accessibility violations found:", results.violations);
throw new Error(
`Found ${results.violations.length} accessibility violations`,
);
}
}