Farol is accessibility testing for Phoenix LiveView, in pure Elixir.
The public surface is deliberately small: check/2 runs the rule catalog
against rendered HTML and returns findings, rules/0 lists the catalog.
Farol.Assertions turns that into assert_accessible/2 for ExUnit, and
Farol.Report renders findings into the didactic output you see when a
test fails.
html = render_component(&user_card/1, user: user)
assert_accessible htmlEvery rule is a plain module implementing the Farol.Rule behaviour, so
the catalog is also the extension point: build your own rule, add it to
the :only list, and it runs alongside the built-ins.
Summary
Functions
Runs rules against a source document and returns a list of Farol.Finding.
The built-in rule catalog: one module per rule, all Farol.Rule implementations.
Runs the selected rules against an already-parsed node forest.
Functions
@spec check(binary(), keyword()) :: [Farol.Finding.t()]
Runs rules against a source document and returns a list of Farol.Finding.
An empty list means the markup passed. Findings come back in document order per rule, grouped by rule, errors and warnings interleaved; the report layer handles presentation.
Raises ArgumentError when the source cannot be parsed. Callers handling
untrusted or broken templates (like mix farol) should call the adapter
directly and feed the nodes to run/2 instead.
Options
:adapter- module implementingFarol.Adapter, defaults toFarol.Adapter.HTML. UseFarol.Adapter.HEExfor template source.:except- rule ids to skip, as strings or atoms. Explicit and greppable on purpose, so exceptions survive code review.:only- run just these rule ids. Useful for testing a custom rule or focusing a test on one concern.
@spec rules() :: [module()]
The built-in rule catalog: one module per rule, all Farol.Rule implementations.
@spec run([Farol.Node.t()], keyword()) :: [Farol.Finding.t()]
Runs the selected rules against an already-parsed node forest.
This is the second half of check/2, exposed so callers that parse on
their own (the static engine in mix farol) can handle parse errors
gracefully and still get the same rule selection semantics.