1.3.1 • Published 4 years ago

@ta11y/reporter v1.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

@ta11y/reporter

Output reporters for ta11y audit results.

NPM Build Status JavaScript Style Guide

Install

npm install --save @ta11y/reporter

Usage

The easiest way to use this package is to use the CLI.

const { audit } = require('@ta11y/core')
const { formatAuditResults } = require('@ta11y/reporter')

audit('https://en.wikipedia.org')
  .then((auditResults) => {
    // overview of results (number of urls visited, success, error)
    console.log(auditResults.summary)

    // save the results to an excel spreadsheet
    return formatAuditResults(auditResults, 'out.xls')
  })

Formats

We support all output formats supported by SheetJS.

file typefile extcontainersheetsDescription
xlsx.xlsxZIPmultiExcel 2007+ XML Format
xlsm.xlsmZIPmultiExcel 2007+ Macro XML Format
xlsb.xlsbZIPmultiExcel 2007+ Binary Format
biff8.xlsCFBmultiExcel 97-2004 Workbook Format
biff5.xlsCFBmultiExcel 5.0/95 Workbook Format
biff2.xlsnonesingleExcel 2.0 Worksheet Format
xlml.xlsnonemultiExcel 2003-2004 (SpreadsheetML)
ods.odsZIPmultiOpenDocument Spreadsheet
fods.fodsnonemultiFlat OpenDocument Spreadsheet
csv.csvnonesingleComma Separated Values
txt.txtnonesingleUTF-16 Unicode Text (TXT)
sylk.sylknonesingleSymbolic Link (SYLK)
html.htmlnonesingleHTML Document
dif.difnonesingleData Interchange Format (DIF)
dbf.dbfnonesingledBASE II + VFP Extensions (DBF)
rtf.rtfnonesingleRich Text Format (RTF)
prn.prnnonesingleLotus Formatted Text
eth.ethnonesingleEthercalc Record Format (ETH)

API

formatAuditResults

Formats and outputs the given audit results from @ta11y/core, optionally writing them to a file.

If no options / filename is passed, the input will be returned untransformed.

Type: function (auditResults, opts): Promise

  • auditResults object JSON audit results to format.
  • opts (object | string)? Filename to write or config options.
    • opts.file string? Filename to write.
    • opts.format string? File format to use (by default this is inferred from the filename).
    • opts.encoding string? File encoding to use (by default this is inferred from the file format).

formatExtractResults

Formats and outputs the given extraction results from @ta11y/extract, optionally writing them to a file.

If no options / filename is passed, the input will be returned untransformed.

Type: function (extractResults, opts, auditResults): Promise

  • extractResults
  • opts (object | string)? Filename to write or config options.
    • opts.file string? Filename to write.
    • opts.format string? File format to use (by default this is inferred from the filename).
    • opts.encoding string? File encoding to use (by default this is inferred from the file format).
  • auditResults object JSON audit results to format.

License

MIT © Saasify