a11yanalyze
Version:
A command-line tool for developers and QA engineers to test web pages and websites for WCAG 2.2 AA accessibility compliance
59 lines • 2.3 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.runManualGuide = runManualGuide;
const inquirer_1 = __importDefault(require("inquirer"));
const wcag_database_1 = require("../data/wcag-database");
const fs_1 = require("fs");
async function runManualGuide(target, options = {}) {
const criteriaKeys = options.criteria || Object.keys(wcag_database_1.WCAG_DATABASE);
const results = [];
for (const key of criteriaKeys) {
const criterion = wcag_database_1.WCAG_DATABASE[key];
if (!criterion)
continue;
const steps = criterion.testing?.manual || [];
const { status } = await inquirer_1.default.prompt([
{
type: 'list',
name: 'status',
message: `Criterion ${criterion.number}: ${criterion.title}\n${criterion.description}\nManual steps:\n- ${steps.join('\n- ')}\nResult?`,
choices: [
{ name: 'Pass', value: 'Pass' },
{ name: 'Fail', value: 'Fail' },
{ name: 'N/A', value: 'N/A' },
{ name: 'Skip', value: 'Skip' }
],
default: 'Pass',
}
]);
let notes = '';
if (status !== 'Skip') {
const notesAnswer = await inquirer_1.default.prompt([
{
type: 'input',
name: 'notes',
message: 'Notes/comments (optional):',
}
]);
notes = notesAnswer.notes || '';
results.push({
criterion: criterion.number,
title: criterion.title,
status,
notes,
});
}
}
const report = {
target,
date: new Date().toISOString(),
results,
};
const outputPath = options.output || `${target.replace(/[^a-z0-9]/gi, '_')}.manual-audit.json`;
(0, fs_1.writeFileSync)(outputPath, JSON.stringify(report, null, 2), 'utf8');
console.log(`Manual audit report saved to ${outputPath}`);
}
//# sourceMappingURL=manual-guide.js.map