Repository URL to install this package:
|
Version:
0.0.9 ▾
|
#!/usr/bin/env node
const path = require('path');
const globby = require('globby');
require('colors');
const { run } = require('./testRunner');
const { setupReportDirectory } = require('./utils/reportUtils');
const version = require('../package.json').version;
/**
* @typedef {Object} A11yTestDefinition
* @property {async function} setup The function run before the test run
* @property {async function} cleanup The function run after the test run
* @property {string} id The name of the test. Used in the name of report files
* @property {object} config The pa11y configuration
*/
/**
* @typedef {Object} A11yTestResult
* @property {number} errors The number of a11y errors
* @property {number} warnings The number of a11y warnings
* @property {number} notices The number of a11y notices
*/
console.log(`A11yTester v${version}\n`.bold);
setupReportDirectory();
// Pick all .a11y.js files and javascript files inside __a11y__ folders
const a11yFiles = globby.sync(['**/*.a11y.js', '**/__a11y__/**/*.js']);
// Require and run
run(a11yFiles.map(file => require(path.resolve(file))));