pa11y
Version:
Pa11y is your automated accessibility testing pal
30 lines (24 loc) • 667 B
JavaScript
;
const bfj = require('bfj');
const report = {};
module.exports = report;
// Pa11y version support
report.supports = '^9.0.0 || ^9.0.0-alpha || ^9.0.0-beta';
// Output formatted results
// NOTE: unlike other reporters, the JSON reporter uses streams and so outputs
// results by itself rather than returning a string
report.results = results => {
const stream = bfj.streamify(results.issues);
stream.on('dataError', error => {
console.error(error.stack);
process.exit(1);
});
stream.on('end', () => {
process.stdout.write('\n');
});
stream.pipe(process.stdout);
};
// Output error messages
report.error = message => {
return message;
};