Open aarongoldenthal opened 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:
results
function, create a unique file name based on the URL, and save the results to the file (which would then be valid for the given format)cli
reporter, although it could be used, but would probably want to strip out the ANSI escape codeserror
function would be written to stderrFor the pa11y reporters:
csv
, html
, and tsv
reporters would work with the above implementationjson
reporter writes to stdout, but could be changed to simply return the results, which would then work with the implementation above. Pa11y already writes that output to stdout, so would be functionally transparent to the user.cli
reporter could be updated to write to stdout itself (as the json
reporter does now). This would be transparent for pa11y, but would allow the reporter to be used directly with pa11y-ci with the expected output. In this case it is valid and logical output on its own.
When
pa11y
loads reporters, it wraps the reporter functions so that any output from any reporter function is written toconsole
(here). That logic is missing frompa11y-ci
(it should probably be here). So, whenpa11y
reporters are used withpa11y-ci
, any reporters that returns a value expecting it to externally be written to console have their output lost. This includes thecli
,csv
,html
, andtsv
reporters. Thejson
reporter is not impacted since it directly writes its output.The dedicated
pa11y-ci
reporters handle their own output so are not effected.