dequelabs / axe-cli

[Deprecated] A command-line interface for the aXe accessibility testing engine
Mozilla Public License 2.0
430 stars 44 forks source link

JSON dump #17

Closed jaimeiniesta closed 7 years ago

jaimeiniesta commented 7 years ago

This is a WIP for the JSON dump option, discussed in #15

CLAassistant commented 7 years ago

CLA assistant check
All committers have signed the CLA.

WilcoFiers commented 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.

jaimeiniesta commented 7 years ago

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?

WilcoFiers commented 7 years ago

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.

jaimeiniesta commented 7 years ago

So you mean to use both options at the same time, like --json-dump --reporter=no-passess, right?

jaimeiniesta commented 7 years ago

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.

jaimeiniesta commented 7 years ago

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!