Open source · Quality & Testing

Accessibility Snapshot Diff

Compare accessibility snapshots for regressions in rendered routes.

v0.1.0 · Node.js 22+ · MIT

Browse the public repository · View releases

accessibility-snapshot-diff compares two already-exported accessibility-tree snapshots. Stable opaque node IDs locate structural and accessible-name regressions without printing potentially private names. It does not launch a browser or inspect a live page. Node.js 22+; zero dependencies.

This walkthrough uses the tool's public README and checked-in example files. Run the command from a repository checkout with Node.js 22+; inspect the source before using it on your own files.

Run the checked-in example

node bin/accessibility-snapshot-diff.mjs --root examples --input passing.json
node bin/accessibility-snapshot-diff.mjs --root examples --input failing.json
npm run check

Read the result

The passing example exits 0; the failing example exits 1 for a removed button name and changed heading level. Invalid CLI configuration exits 2 with empty stdout. Unreadable or unusable export evidence exits 2 with an incomplete JSON report. Stdout is otherwise exactly one JSON report. The real input path must remain inside the real --root.

Where this check stops

Strict UTF-8; maximum 1,048,576 input bytes, 300 nodes per snapshot, 50 ignored IDs, JSON depth 4 (root is 0), 5,000 ms injected processing time. Exact N and N+1 boundary tests cover every bound. IDs and roles are 1–128 code units; names at most 512 code units. Duplicate JSON keys, including escaped spellings, and unknown fields are refused.

Before adapting the command to your own workflow, review the accepted inputs, exit codes and safety boundaries in the README.

Compiled with AI assistance from checked-in public documentation and example scripts. Run the example and review the repository's current documentation before relying on its result.