pa11y / pa11y-ci

Pa11y CI is a CI-centric accessibility test runner, built using Pa11y
https://pa11y.org
GNU Lesser General Public License v3.0
515 stars 63 forks source link

Pa11y reporters do not output to console when used with Pa11y CI #174

Open aarongoldenthal opened 2 years ago

aarongoldenthal commented 2 years ago

When pa11y loads reporters, it wraps the reporter functions so that any output from any reporter function is written to console (here). That logic is missing from pa11y-ci (it should probably be here). So, when pa11y reporters are used with pa11y-ci, any reporters that returns a value expecting it to externally be written to console have their output lost. This includes the cli, csv, html, and tsv reporters. The json reporter is not impacted since it directly writes its output.

The dedicated pa11y-ci reporters handle their own output so are not effected.

aarongoldenthal commented 2 years ago

After thinking about this a little, if pa11y-ci were updated to simply write the value returned from a reporter to stdout, as pa11y does (in most cases), then it would do the same for all analyzed files. The results could be piped to a file, but the result wouldn't be valid for the given format (excluding cli for the moment, and technically tsv and csv would but would have headers repeated for every file).

An alternative proposal - create a new reporter that's essentially a shim for using any pa11y reporter:

For the pa11y reporters: