axe DevTools Node Logger API Reference

Link to axe DevTools Node Logger API Reference copied to clipboard

API Reference for the @axe-devtools/logger package

This document describes the methods implemented by the AxeDevToolsLogger class in the @axe-devtools/logger package.


Creates an axe DevTools logger which you can use to write a JSON results file to the specified directory. You can use the Reporter API to generate reports in several different formats from this results file.

constructor(reportName: string, directory?: string)

Example usage:

let logger = new AxeDevToolsLogger("Report Name", "directory-name");

Because the AxeDevToolsReporter class inherits from this class, you typically invoke methods in the AxeDevToolsLogger class via your AxeDevToolsReporter instance.


Name Type Description
reportName string The name of the report, which will be the first part of the output results file name.
directory string (optional) The directory where the logger API will write the JSON results file


Name Description
getTestResults Returns an array of test results.
logTestResult Log test results.


Returns an array of of axe DevTools test results. The results can be filtered by userAgent.

public getTestResults(userAgent?: string): AxeDevToolsResults[] 


Name Type Description
userAgent string (optional) Specifies the userAgent for filtering the results. Only results where the userAgent matches will be written to disk.


An array of AxeDevToolsResults


Logs the current accessibility result to disk. See Reporter Code Examples for code examples.

public logTestResult(
    id: string,
    finding: Findings,
    options?: LogTestResultOptions
  ): void


Name Type Description
id string An user-supplied identifier for the finding
finding Findings object The Findings object obtained from running a test, usually results object from run() or analyze()
options LogTestResultsOptions object (optional) Logger configuration options


Nothing is returned