axe DevTools Node Reporter API Reference

Link to axe DevTools Node Reporter API Reference copied to clipboard

API Reference for the @axe-devtools/reporter package

This document describes the methods provided by the AxeDevToolsReporter class.

The AxeDevToolsReporter class extends the AxeDevToolsLogger class (from the @axe-devtools/logger package), so you can create an instance of AxeDevToolsReporter and call methods offered by the AxeDevToolsLogger class. See the axe DevTools Logger Reference for more information on the methods provided by the AxeDevToolsLogger class.

Constructor

constructor(reportName: string, directory?: string)

Example usage:

const axeReporter = new AxeDevToolsReporter("AxeDevTools-Results", "./test-results/");

Parameters

Name Type Description
reportName string The title of the report. The reportName value will become the first segment of the JSON results's file name.
directory string (optional) Directory where the report will be written. Directories will be recursively created if they do not already exist.

Methods

Each of these methods creates the specified report from the results JSON file that is produced by the logTestResult method.

Name Description
buildCSV Create a CSV report
buildHTML Create an HTML report
buildJUnitXML Create an XML report

buildCSV

Creates a CSV file from the results JSON file created by the logTestResult method.

buildCSV(directory: string, userAgent?: string, filterOpts?: string[]): Promise<void>;

Parameters

Name Type Description
directory string The directory to create the output .csv file. All directories will be recursively created if they do not already exist.
userAgent string (optional) Only results with the specified user agent will appear in the .csv file
filterOpts array of strings (optional) An array of filter options for selecting results.

Returns

Promise<void>

buildHTML

Creates an HTML file in the directory specified from the accessibility results JSON file.

buildHTML(directory: string, userAgent?: string): Promise<void>;

Parameters

Name Type Description
directory string The directory to create the output .html file. All directories will be recursively created if they do not already exist.
userAgent string (optional) Only results with the specified user agent will appear in the .html report file

Returns

Promise<void>

buildJUnitXML

Creates a JUnit XML file in the directory specified from the JSON accessibility results.

buildJUnitXML(directory: string, userAgent?: string): Promise<void>;

Parameters

Name Type Description
directory string The directory to create the output .xml file. All directories will be recursively created if they do not already exist.
userAgent string (optional) Only results with the specified user agent will appear in the .xml report file

Returns

Promise<void>