Closed jaimeiniesta closed 5 years ago
Sounds good. Do you have any suggestions? Maybe something like --dump
?
How about --format=json
?
...or maybe just --dump
, as there are no plans to add other formats like XML or CSV I guess.
Maybe we should use --reporter
. Axe-core has a few different reporters you could use, that way you get those features too.
I've sent a PR so we can discuss over the code. By now we have a first working version that adds an option:
-j, --json-dump Output the results directly as JSON, without saving to a file
I went for this as -d
is already used for --dir
, and because it's more explicit about the format.
Now, the thing with index.js
currently is that there are many console.log
everywhere that need to be silenced in this case, so that we only produce JSON output.
I'll try to clean this up by using a logger that will know if it should stay quiet in this situation.
@jaimeiniesta what's the status of this–were you going to add a PR?
@marcysutton I started with this and there's a PR https://github.com/dequelabs/axe-cli/pull/17
But later I abandoned the idea due to lack of time to do that properly, sorry. So it's OK to close this issue or someone else pick it.
I think we can pick this issue up ourselves. I've been working on an update for axe-cli, to get rid of PhantomJS and to run axe 3.0.
Currently axe-cli has the
--save
option to save the results to a file. This is great but it could also be helpful to have an option to directly output this JSON tostdout
.This can simplify integrating axe-cli in web services that take an URL to test, and return the JSON results - without needing to save to disk, read that file to return its contents and then removing the file.
This is what we did in accesslint:
https://github.com/accesslint/accesslint-cli.js/pull/16
I can submit a PR to add this if it sounds OK to you.