Closed jaimeiniesta closed 7 years ago
Hi Jaime. Looking good so far, but I would suggest we use --reporter
, and allow users to set which reporter they want to use for their JSON object. That way we hit two birds with one stone. I didn't implement that option initially, because for some of the reporters the CLI output wouldn't work anymore (as the format changed). But if we're outputting raw JSON, we might as well allow users to define which reporter they want. That way you could for instance have it only output violations.
For that I'll need to investigate more. I see in https://github.com/dequelabs/axe-core/blob/develop/doc/API.md that the reporter
option can take v1
or v2
.
But then in https://github.com/dequelabs/axe-core/tree/develop/lib/core/reporters I see there are more reporters. Should all these be an option as well?
If we just pipe the value that the user puts in --reporter into the reporter option, it'll work. I'll check with the team if we want to document the other reporters. I can imagine particularly for CLI it would be useful to use the no-passess reporter.
So you mean to use both options at the same time, like --json-dump --reporter=no-passess
, right?
I've refactored this, found the good spot where to convert the results to JSON.
Still, don't like it as there are a lot of console logs that need to be silenced in this case. I think we should split this into separate reporters.
I'm finding this is going to be more complicated than just dealing with the saved file, so I'm not going to continue with this PR at least in the short term.
Thanks for considering it!
This is a WIP for the JSON dump option, discussed in #15