dequelabs / axe-cli

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

JSON output including non-JSON #87

Closed jaimeiniesta closed 5 years ago

jaimeiniesta commented 5 years ago

I've been trying the new option to output results as JSON directly to stdout and it works great but I've found that in some cases some extra warnings are also output, which can lead to problems in parsing JSON, for example:

axe-cli -j http://elpais.com

Failed to inject axe-core into one of the iframes!
[
  {
    "inapplicable": [
      {
        "description": "Ensures every accesskey attribute value is unique",
        "help": "accesskey attribute value must be unique",
        "helpUrl": "https://dequeuniversity.com/rules/axe/3.1/accesskeys?application=webdriverjs",
        "id": "accesskeys",
        "impact": null,
        "nodes": [],
        "tags": [
          "best-practice",
          "cat.keyboard"
        ]
      },
      ...

I've tried this but it doesn't help, these warnings still appear in stdout:

axe-cli -j http://elpais.com > out.json 2>/dev/null
stephenmathieson commented 5 years ago

Good catch! IIRC that log is coming from axe-webdriverjs, so we'll have to update it. I think the simplest fix would be to log the error to stderr (where errors belong).

I'll see if I can get to this in the next day or so.

stephenmathieson commented 5 years ago

This has been fixed in axe-webdriverjs. All we should need to do now is update the dependency and push a new version here.