Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

pa11y/pa11y-reporter-json

Repository files navigation

Pa11y JSON Reporter

This repository is now deprecated.

The reporter has been merged into pa11y/reporters.

A JSON reporter for Pa11y 5.0.

⚠️ this reporter is built into Pa11y, there's no need to install separately ⚠️

NPM version Build status LGPL-3.0 licensed

Table of contents

Requirements

Pa11y JSON Reporter is compatible with Pa11y 5 and later versions. It will not work with older versions of Pa11y.

Compatibility chart

Pa11y version Pa11y CLI reporter version
1.x - 4.x Unsupported
5.x 1.x
6.x 2.x

Usage

Command-Line

Install Pa11y and Pa11y JSON Reporter with npm (locally or globally is fine):

npm install -g pa11y pa11y-reporter-json

Run Pa11y using the JSON reporter:

pa11y --reporter json http://example.com

JavaScript

Assuming you've installed both Pa11y and Pa11y JSON Reporter:

const json = require('pa11y-reporter-json');
const pa11y = require('pa11y');

pa11y('http://example.com').then(results => {
    // Returns a string with the results formatted as JSON
    const jsonResults = json.results(results);
    console.log(jsonResults);
});

Contributing

There are many ways to contribute to Pa11y JSON Reporter, we cover these in the contributing guide for this repo.

If you're ready to contribute some code, clone this repo locally and commit your code on a new branch.

Please write unit tests for your code, and check that everything works by running the following before opening a Pull Request:

make ci

You can also run verifications and tests individually:

make verify              # Verify all of the code (ESLint)
make test                # Run all tests
make test-unit           # Run the unit tests
make test-unit-coverage  # Run the unit tests with coverage

License

Pa11y JSON Reporter is licensed under the Lesser General Public License (LGPL-3.0).
Copyright © 2017, Team Pa11y