1

I'm trying to get pa11y to output HTML and CSV reports.

Here's the errors:

Unable to load reporter "csv"

Unable to load reporter "html"

I have pa11y configured to generate cli, csv, and html reports, but only the cli report is output correctly.

My pa11yconfig.json looks like this:

{
  "standard": "WCAG2AAA",
  "level": "notice",
  "defaults": {
    "chromeLaunchConfig": {
      "args": [
        "--no-sandbox"
      ]
    },
    "reporters": [
      "cli",
      "csv",
      "html"
    ],
    "runners": [
      "axe",
      "htmlcs"
    ],
    "timeout": 1000000,
    "wait": 2000
  }
}

And I'm running pa11y like this:

pa11y-ci --sitemap "$SITEMAP_URL"  > "$OUTPUT_DIR/success-pa11y-report.txt" 2> "$OUTPUT_DIR/failures-pa11y-report.txt"

This command is being executed as part of GitHub Actions, which looks like this:

  - name: Install pa11y.
    run: npm install -g pa11y-ci
  - name: 'TEST: Run pa11y tests.'
    run: my-pa11y-script.sh

My understanding is that the reporters are now bundled with pa11y, so how can I get pa11y to recognize them?

Patrick Kenny
  • 4,515
  • 7
  • 47
  • 76
  • 3
    Is there any chance that you're running `pa11y-ci` but checking the documentation for `pa11y` instead? `pa11y-ci` now supports reporters, but `pa11y-ci`'s reporters are different from the ones in `pa11y` itself. There's currently two reporters bundled with `pa11y-ci`: the `cli` reporter, and the `json` reporter. You can use additional external reporters not bundled with `pa11y-ci`: https://github.com/pa11y/pa11y-ci#reporters – José Luis Feb 21 '22 at 16:28

1 Answers1

1

As noted by @José Luis, pa11y and pa11y-ci reporters are different.

There is no csv reporter for pa11y-ci, but there is a bundled json reporter.

As for html reporters, there is an html reporter included with pa11y, but for pa11y-ci, you need to download the pa11y-ci-reporter-html npm module.

Reference:

The pa11y-ci docs currently refer to the deprecated pa11y-html-reporter module, which will not work; I've opened a PR to update the docs.

Patrick Kenny
  • 4,515
  • 7
  • 47
  • 76