runAccessibilityAudit returns AccessKitAuditFinding[]. Use it directly for assertions, or pass the array through formatAuditFindingsForConsole for a consistent console or log file layout.
AccessKitAuditFinding
| Field | Description |
|---|---|
| id | Stable string for this row (violation + node). |
| ruleId | WCAG-style id when available, else axe rule id. |
| wcagLevel | "A", "AA", "AAA", or omitted for non-WCAG rules. |
| category | Topic (e.g. color, forms) when present. |
| severity | "error" or "warning". |
| message | Short rule description. |
| suggestion | How to fix, combined from failure summary + description. |
| helpUrl | Optional link to Deque / rule docs. |
| selector | CSS selector or snippet of the element that failed |
| standards | Additional standards the rule belongs to (e.g. ["TTv5", "RGAAv4"]). Undefined when the rule only maps to WCAG |
Filtering
Build your own pass/fail rules on top of the array; for example only Level A and AA errors:
import type { AccessKitAuditFinding } from "@access-kit/react"
function blockingForAa(findings: AccessKitAuditFinding[]) {
return findings.filter(
(f) =>
f.severity === "error" &&
(f.wcagLevel === "A" || f.wcagLevel === "AA"),
)
}Built-in console format
The CI audit script and DevTools use the same formatter for readable logs:
import { formatAuditFindingsForConsole } from "@access-kit/react"
// Logs the same human-readable layout as DevTools / CI script
const text = formatAuditFindingsForConsole(findings)
console.log(text)CI artifacts
Write JSON for later triage or dashboards. The Auditing in CI doc explains appending markdown to GITHUB_STEP_SUMMARY when AUDIT_SUMMARY_PATH is set.
import { writeFileSync } from "fs"
import type { AccessKitAuditFinding } from "@access-kit/react"
export function writeFindingsJson(path: string, findings: AccessKitAuditFinding[]) {
writeFileSync(path, JSON.stringify(findings, null, 2), "utf-8")
}Tag-based blocking in CI
The reference audit script treats AUDIT_TAGS as the set of tags that produce a blocking error. WCAG levels A, AA, AAA match wcagLevel; cat.* tags match category; other tags (e.g. best-practice) are passed to axe as extra rules and non-WCAG findings from those rules block when those tags are listed. Adjust tags to match your team’s policy.
See also
- Programmatic audits: where findings are produced.
- Auditing in CI: end-to-end pipeline example.