accessibility-checker
Advanced tools
Comparing version 3.1.5 to 3.1.6
@@ -144,3 +144,3 @@ #!/usr/bin/env node | ||
if (!lastArg || lastArg === "help") { | ||
console.log("Usage: achecker [flags] [command / file / directory / URL]\n\nCommands:\n archives : Display valid archive ids and policy ids\n\nFlags:\n Flags can be set via .achecker.yml or achecker.js files. Specifying the flags here\n will override those options.\n\n --ruleArchive : Archive id to use. Run \"achecker archives\" for valid ids\n --policies : Comma separated list of policies. Run \"achecker archives\"\n for valid ids\n --failLevels : Comma separated list of levels that will indicate\n a failure. Valid values: violation,\n potentialviolation, recommendation,\n potentialrecommendation, manual\n --reportLevels : Comma separated list of levels that will be included\n in reports. Valid values: violation,\n potentialviolation, recommendation,\n potentialrecommendation, manual, pass\n --outputFormat : Comma separated list of output report formats.\n Valid values: json, csv\n --label : Comma separated list of labels to include in reports\n --outputFolder : Folder to output results and reports\n --baselineFolder : Folder that includes baseline files\n"); | ||
console.log("Usage: achecker [flags] [command / file / directory / URL]\n\nCommands:\n archives : Display valid archive ids and policy ids\n\nFlags:\n Flags can be set via .achecker.yml or aceconfig.js files. Specifying the flags here\n will override those options.\n\n --ruleArchive : Archive id to use. Run \"achecker archives\" for valid ids\n --policies : Comma separated list of policies. Run \"achecker archives\"\n for valid ids\n --failLevels : Comma separated list of levels that will indicate\n a failure. Valid values: violation,\n potentialviolation, recommendation,\n potentialrecommendation, manual\n --reportLevels : Comma separated list of levels that will be included\n in reports. Valid values: violation,\n potentialviolation, recommendation,\n potentialrecommendation, manual, pass\n --outputFormat : Comma separated list of output report formats.\n Valid values: json, csv\n --label : Comma separated list of labels to include in reports\n --outputFolder : Folder to output results and reports\n --baselineFolder : Folder that includes baseline files\n"); | ||
process.exit(-1); | ||
@@ -147,0 +147,0 @@ } |
@@ -157,2 +157,5 @@ /****************************************************************************** | ||
export declare function cleanComplianceObjectBeforeCompare(objectToClean: any): any; | ||
export declare function addRuleset(ruleset: any): void; | ||
export declare function getRuleset(rsId: any): Promise<any>; | ||
export declare function getRulesets(): Promise<any[]>; | ||
export declare const ruleIdToLegacyId: { | ||
@@ -159,0 +162,0 @@ RPT_List_Misuse: string; |
61
index.js
@@ -17,6 +17,43 @@ "use strict"; | ||
*****************************************************************************/ | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ruleIdToLegacyId = exports.cleanComplianceObjectBeforeCompare = exports.diffResultsWithExpected = exports.getBaseline = exports.getDiffResults = exports.close = exports.getConfigUnsupported = exports.getConfig = exports.stringifyResults = exports.assertCompliance = exports.getCompliance = void 0; | ||
exports.ruleIdToLegacyId = exports.getRulesets = exports.getRuleset = exports.addRuleset = exports.cleanComplianceObjectBeforeCompare = exports.diffResultsWithExpected = exports.getBaseline = exports.getDiffResults = exports.close = exports.getConfigUnsupported = exports.getConfig = exports.stringifyResults = exports.assertCompliance = exports.getCompliance = void 0; | ||
var ACBrowserManager_1 = require("./lib/ACBrowserManager"); | ||
var ACConfigManager_1 = require("./lib/ACConfigManager"); | ||
var ACEngineManager_1 = require("./lib/ACEngineManager"); | ||
var ACHelper_1 = require("./lib/ACHelper"); | ||
@@ -202,2 +239,24 @@ var ACReportManager_1 = require("./lib/ACReportManager"); | ||
exports.cleanComplianceObjectBeforeCompare = cleanComplianceObjectBeforeCompare; | ||
function addRuleset(ruleset) { | ||
ACEngineManager_1.ACEngineManager.addRuleset(ruleset); | ||
} | ||
exports.addRuleset = addRuleset; | ||
function getRuleset(rsId) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, ACEngineManager_1.ACEngineManager.getRuleset(rsId)]; | ||
}); | ||
}); | ||
} | ||
exports.getRuleset = getRuleset; | ||
; | ||
function getRulesets() { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, ACEngineManager_1.ACEngineManager.getRulesets()]; | ||
}); | ||
}); | ||
} | ||
exports.getRulesets = getRulesets; | ||
; | ||
exports.ruleIdToLegacyId = { | ||
@@ -204,0 +263,0 @@ "RPT_List_Misuse": "3", |
@@ -149,3 +149,3 @@ "use strict"; | ||
// Clear out any pages that are already closed | ||
ACBrowserManager.pages = ACBrowserManager.pages.map(function (page) { return !page.isClosed() ? page : null; }); | ||
ACBrowserManager.pages = ACBrowserManager.pages.filter(function (page) { return page && !page.isClosed(); }); | ||
for (_i = 0, _b = ACBrowserManager.pages; _i < _b.length; _i++) { | ||
@@ -152,0 +152,0 @@ page = _b[_i]; |
@@ -132,2 +132,5 @@ "use strict"; | ||
_a.trys.push([1, 3, , 4]); | ||
if (ACConfig.ignoreHTTPSErrors) { | ||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; | ||
} | ||
return [4 /*yield*/, new Promise(function (resolve, reject) { | ||
@@ -134,0 +137,0 @@ request.get(ruleArchiveFile, function (error, response, body) { |
@@ -65,5 +65,5 @@ "use strict"; | ||
// both json and js are present it loads js first. | ||
configFiles: [".achecker.yml", ".achecker.yaml", "achecker", pathLib.join(".config", ".achecker.yml"), pathLib.join(".config", ".achecker.yaml"), pathLib.join(".config", "achecker")], | ||
configFiles: [".achecker.yml", ".achecker.yaml", "achecker", "aceconfig", pathLib.join(".config", ".achecker.yml"), pathLib.join(".config", ".achecker.yaml"), pathLib.join(".config", "achecker"), pathLib.join(".config", "aceconfig")], | ||
ignoreHTTPSErrors: false | ||
}; | ||
//# sourceMappingURL=ACConstants.js.map |
export declare class ACEngineManager { | ||
static customRulesets: any[]; | ||
static loadEngine(content: any): Promise<any>; | ||
@@ -19,4 +20,6 @@ static loadEngineLocal(): Promise<void>; | ||
static getHelpURL(ruleId: any): any; | ||
static getRulesets(): any; | ||
static addRuleset: (ruleset: any) => void; | ||
static getRuleset: (rsId: any) => Promise<any>; | ||
static getRulesets: () => Promise<any[]>; | ||
static getChecker(): any; | ||
} |
@@ -210,9 +210,37 @@ "use strict"; | ||
; | ||
ACEngineManager.getRulesets = function () { | ||
return checker.rulesets; | ||
}; | ||
; | ||
ACEngineManager.getChecker = function () { | ||
return checker; | ||
}; | ||
ACEngineManager.customRulesets = []; | ||
ACEngineManager.addRuleset = function (ruleset) { | ||
ACEngineManager.customRulesets.push(ruleset); | ||
}; | ||
ACEngineManager.getRuleset = function (rsId) { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (!!checker) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, ACEngineManager.loadEngineLocal()]; | ||
case 1: | ||
_a.sent(); | ||
_a.label = 2; | ||
case 2: return [2 /*return*/, ACEngineManager.customRulesets.concat(checker.rulesets).filter((function (rs) { return rs.id === rsId; }))[0]]; | ||
} | ||
}); | ||
}); }; | ||
ACEngineManager.getRulesets = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (!!checker) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, ACEngineManager.loadEngineLocal()]; | ||
case 1: | ||
_a.sent(); | ||
_a.label = 2; | ||
case 2: return [2 /*return*/, ACEngineManager.customRulesets.concat(checker.rulesets)]; | ||
} | ||
}); | ||
}); | ||
}; | ||
return ACEngineManager; | ||
@@ -219,0 +247,0 @@ }()); |
@@ -298,10 +298,10 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var startScan, browser, scriptStr, manage, report, getPolicies, valPolicies, finalReport, url, origReport, counts, image, screenshotResult, err_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
var startScan, browser, scriptStr, manage, report, getPolicies, valPolicies, _a, _b, finalReport, url, origReport, counts, image, screenshotResult, err_1; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
_a.trys.push([0, 7, , 8]); | ||
_c.trys.push([0, 7, , 8]); | ||
startScan = Date.now(); | ||
browser = parsed; | ||
scriptStr = "let cb = arguments[arguments.length - 1];\ntry {\nlet policies = " + JSON.stringify(Config.policies) + ";\n\nlet checker = new window.ace.Checker();\nsetTimeout(function() {\n checker.check(document, policies).then(function(report) {\n for (const result of report.results) {\n delete result.node;\n }\n cb(report);\n })\n},0)\n} catch (e) {\ncb(e);\n}"; | ||
scriptStr = "let cb = arguments[arguments.length - 1];\ntry {\nlet policies = " + JSON.stringify(Config.policies) + ";\n\nlet checker = new window.ace.Checker();\nlet customRulesets = " + JSON.stringify(ACEngineManager_1.ACEngineManager.customRulesets) + ";\ncustomRulesets.map((rs) => checker.addRuleset(rs));\nsetTimeout(function() {\n checker.check(document, policies).then(function(report) {\n for (const result of report.results) {\n delete result.node;\n }\n cb(report);\n })\n},0)\n} catch (e) {\ncb(e);\n}"; | ||
manage = browser.manage(); | ||
@@ -318,3 +318,3 @@ if (manage.timeouts) { | ||
case 1: | ||
report = _a.sent(); | ||
report = _c.sent(); | ||
report = ACReportManager_1.ACReportManager.setLevels(report); | ||
@@ -324,7 +324,8 @@ getPolicies = "return new window.ace.Checker().rulesetIds;"; | ||
checkPolicy = true; | ||
_b = (_a = ACEngineManager_1.ACEngineManager.customRulesets).concat; | ||
return [4 /*yield*/, browser.executeScript(getPolicies)]; | ||
case 2: | ||
valPolicies = _a.sent(); | ||
valPolicies = _b.apply(_a, [_c.sent()]); | ||
areValidPolicy(valPolicies, curPol); | ||
_a.label = 3; | ||
_c.label = 3; | ||
case 3: | ||
@@ -335,3 +336,3 @@ finalReport = void 0; | ||
case 4: | ||
url = _a.sent(); | ||
url = _c.sent(); | ||
origReport = JSON.parse(JSON.stringify(report)); | ||
@@ -356,3 +357,3 @@ origReport = ACReportManager_1.ACReportManager.buildReport(origReport, {}, url, label, startScan); | ||
case 5: | ||
image = _a.sent(); | ||
image = _c.sent(); | ||
screenshotResult = { | ||
@@ -364,3 +365,3 @@ image: image, | ||
ACReportManager_1.ACReportManager.sendScreenShotToReporter(screenshotResult); | ||
_a.label = 6; | ||
_c.label = 6; | ||
case 6: return [2 /*return*/, { | ||
@@ -371,3 +372,3 @@ "report": finalReport, | ||
case 7: | ||
err_1 = _a.sent(); | ||
err_1 = _c.sent(); | ||
console.error(err_1); | ||
@@ -384,11 +385,12 @@ return [2 /*return*/, Promise.reject(err_1)]; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var startScan, page, report, valPolicies, finalReport, url, origReport, counts, image, screenshotResult, err_2; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
var startScan, page, report, valPolicies, _a, _b, finalReport, url, origReport, counts, image, screenshotResult, err_2; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
_a.trys.push([0, 7, , 8]); | ||
_c.trys.push([0, 7, , 8]); | ||
startScan = Date.now(); | ||
page = parsed; | ||
return [4 /*yield*/, page.evaluate(function (policies) { | ||
return [4 /*yield*/, page.evaluate(function (policies, customRulesets) { | ||
var checker = new window.ace.Checker(); | ||
customRulesets.forEach(function (rs) { return checker.addRuleset(rs); }); | ||
return new Promise(function (resolve, reject) { | ||
@@ -405,13 +407,14 @@ setTimeout(function () { | ||
}); | ||
}, Config.policies)]; | ||
}, Config.policies, ACEngineManager_1.ACEngineManager.customRulesets)]; | ||
case 1: | ||
report = _a.sent(); | ||
report = _c.sent(); | ||
report = ACReportManager_1.ACReportManager.setLevels(report); | ||
if (!(curPol != null && !checkPolicy)) return [3 /*break*/, 3]; | ||
_b = (_a = ACEngineManager_1.ACEngineManager.customRulesets).concat; | ||
return [4 /*yield*/, page.evaluate("new window.ace.Checker().rulesetIds")]; | ||
case 2: | ||
valPolicies = _a.sent(); | ||
valPolicies = _b.apply(_a, [_c.sent()]); | ||
checkPolicy = true; | ||
areValidPolicy(valPolicies, curPol); | ||
_a.label = 3; | ||
_c.label = 3; | ||
case 3: | ||
@@ -422,3 +425,3 @@ finalReport = void 0; | ||
case 4: | ||
url = _a.sent(); | ||
url = _c.sent(); | ||
origReport = JSON.parse(JSON.stringify(report)); | ||
@@ -446,3 +449,3 @@ origReport = ACReportManager_1.ACReportManager.buildReport(origReport, {}, url, label, startScan); | ||
case 5: | ||
image = _a.sent(); | ||
image = _c.sent(); | ||
screenshotResult = { | ||
@@ -454,3 +457,3 @@ image: image, | ||
ACReportManager_1.ACReportManager.sendScreenShotToReporter(screenshotResult); | ||
_a.label = 6; | ||
_c.label = 6; | ||
case 6: | ||
@@ -463,3 +466,3 @@ page.aceBusy = false; | ||
case 7: | ||
err_2 = _a.sent(); | ||
err_2 = _c.sent(); | ||
console.error(err_2); | ||
@@ -476,3 +479,3 @@ return [2 /*return*/, Promise.reject(err_2)]; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var startScan, checker, report, valPolicies, finalReport, url, origReport, counts, err_3; | ||
var startScan, checker_1, report, valPolicies, finalReport, url, origReport, counts, err_3; | ||
return __generator(this, function (_a) { | ||
@@ -483,4 +486,5 @@ switch (_a.label) { | ||
startScan = Date.now(); | ||
checker = ACEngineManager_1.ACEngineManager.getChecker(); | ||
return [4 /*yield*/, checker.check(parsed, Config.policies) | ||
checker_1 = ACEngineManager_1.ACEngineManager.getChecker(); | ||
ACEngineManager_1.ACEngineManager.customRulesets.forEach(function (rs) { return checker_1.addRuleset(rs); }); | ||
return [4 /*yield*/, checker_1.check(parsed, Config.policies) | ||
.then(function (report) { | ||
@@ -497,3 +501,3 @@ for (var _i = 0, _a = report.results; _i < _a.length; _i++) { | ||
if (curPol != null && !checkPolicy) { | ||
valPolicies = checker.rulesetIds; | ||
valPolicies = checker_1.rulesetIds; | ||
checkPolicy = true; | ||
@@ -500,0 +504,0 @@ areValidPolicy(valPolicies, curPol); |
{ | ||
"name": "accessibility-checker", | ||
"version": "3.1.5", | ||
"version": "3.1.6", | ||
"description": "An automated testing tools for accessibility testing using Puppeteer, Selenium, or Zombie", | ||
@@ -21,3 +21,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"chromedriver": "^87.0.5", | ||
"chromedriver": "^89.0.0", | ||
"deep-diff": "^0.3.4", | ||
@@ -24,0 +24,0 @@ "js-yaml": "^3.13.1", |
@@ -124,3 +124,3 @@ # accessibility-checker | ||
A similar `achecker.js` file can also be used: | ||
A similar `aceconfig.js` file can also be used: | ||
@@ -360,3 +360,3 @@ ```js | ||
Retrieve the configuration object used by accessibility-checker. See achecker.js / .achecker.yml above for details | ||
Retrieve the configuration object used by accessibility-checker. See aceconfig.js / .achecker.yml above for details | ||
@@ -363,0 +363,0 @@ ### async aChecker.close() |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
2737325
15311
13
+ Addedchromedriver@89.0.0(transitive)
- Removedchromedriver@87.0.7(transitive)
Updatedchromedriver@^89.0.0