accessibility-checker 3.1.0 → 3.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/bin/achecker.d.ts +2 -0
- package/bin/achecker.js +293 -177
- package/bin/achecker.js.map +1 -0
- package/index.d.ts +317 -0
- package/index.js +359 -13
- package/index.js.map +1 -0
- package/lib/ACBrowserManager.d.ts +22 -0
- package/lib/ACBrowserManager.js +237 -0
- package/lib/ACBrowserManager.js.map +1 -0
- package/lib/ACConfigManager.d.ts +6 -0
- package/lib/ACConfigManager.js +399 -0
- package/lib/ACConfigManager.js.map +1 -0
- package/lib/ACConstants.d.ts +17 -0
- package/lib/ACConstants.js +12 -38
- package/lib/ACConstants.js.map +1 -0
- package/lib/ACEngineManager.d.ts +21 -0
- package/lib/ACEngineManager.js +220 -0
- package/lib/ACEngineManager.js.map +1 -0
- package/lib/ACHelper.d.ts +2 -0
- package/lib/ACHelper.js +485 -2085
- package/lib/ACHelper.js.map +1 -0
- package/lib/ACReportManager.d.ts +586 -0
- package/lib/ACReportManager.js +1150 -0
- package/lib/ACReportManager.js.map +1 -0
- package/lib/api/IChecker.d.ts +131 -0
- package/lib/api/IChecker.js +11 -0
- package/lib/api/IChecker.js.map +1 -0
- package/lib/api/IEngine.d.ts +124 -0
- package/lib/api/IEngine.js +110 -0
- package/lib/api/IEngine.js.map +1 -0
- package/lib/api/IMapper.d.ts +37 -0
- package/lib/api/IMapper.js +18 -0
- package/lib/api/IMapper.js.map +1 -0
- package/lib/log/ACMetricsLogger.d.ts +67 -0
- package/lib/log/ACMetricsLogger.js +40 -66
- package/lib/log/ACMetricsLogger.js.map +1 -0
- package/lib/reporters/ACReporterCSV.d.ts +103 -0
- package/lib/reporters/ACReporterCSV.js +83 -152
- package/lib/reporters/ACReporterCSV.js.map +1 -0
- package/lib/reporters/ACReporterHTML.d.ts +114 -0
- package/lib/reporters/ACReporterHTML.js +150 -293
- package/lib/reporters/ACReporterHTML.js.map +1 -0
- package/lib/reporters/ACReporterJSON.d.ts +114 -0
- package/lib/reporters/ACReporterJSON.js +95 -249
- package/lib/reporters/ACReporterJSON.js.map +1 -0
- package/lib/reporters/ReportUtil.d.ts +33 -0
- package/lib/reporters/ReportUtil.js +65 -0
- package/lib/reporters/ReportUtil.js.map +1 -0
- package/lib/reporters/genReport.d.ts +1 -0
- package/lib/reporters/genReport.js +13 -11
- package/lib/reporters/genReport.js.map +1 -0
- package/package.json +4 -3
- package/lib/ACConfigLoader.js +0 -358
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.ACConfigManager = void 0;
|
|
40
|
+
/******************************************************************************
|
|
41
|
+
Copyright:: 2020- IBM, Inc
|
|
42
|
+
|
|
43
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
44
|
+
you may not use this file except in compliance with the License.
|
|
45
|
+
You may obtain a copy of the License at
|
|
46
|
+
|
|
47
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
48
|
+
|
|
49
|
+
Unless required by applicable law or agreed to in writing, software
|
|
50
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
51
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
52
|
+
See the License for the specific language governing permissions and
|
|
53
|
+
limitations under the License.
|
|
54
|
+
*****************************************************************************/
|
|
55
|
+
// Load all the modules that are needed
|
|
56
|
+
var pathLib = require("path");
|
|
57
|
+
var fs = require("fs");
|
|
58
|
+
var YAML = require("js-yaml");
|
|
59
|
+
var ACConstants_1 = require("./ACConstants");
|
|
60
|
+
var uuid = require("uuid");
|
|
61
|
+
var request = require("request");
|
|
62
|
+
/**
|
|
63
|
+
* This function is responsible converting policies into an Array based on string or Array.
|
|
64
|
+
*
|
|
65
|
+
* i.e. convert array into string version of array
|
|
66
|
+
* "CI162_5_2_DCP070116,CI162_5_2_DCP070116"
|
|
67
|
+
*
|
|
68
|
+
* converts to:
|
|
69
|
+
*
|
|
70
|
+
* [
|
|
71
|
+
* "CI162_5_2_DCP070116",
|
|
72
|
+
* "CI162_5_2_DCP070116"
|
|
73
|
+
* ]
|
|
74
|
+
*
|
|
75
|
+
* @param {Array or String} policies - Provide list of policies, single policy or comma seperated policies
|
|
76
|
+
*
|
|
77
|
+
* @return {Array} policies - return the policy converted into Array version
|
|
78
|
+
*
|
|
79
|
+
* @memberOf this
|
|
80
|
+
*/
|
|
81
|
+
function convertPolicies(policies) {
|
|
82
|
+
ACConstants_1.ACConstants.DEBUG && console.log("START 'convertPolicies' function");
|
|
83
|
+
ACConstants_1.ACConstants.DEBUG && console.log("Converting policy provided to Array: ");
|
|
84
|
+
ACConstants_1.ACConstants.DEBUG && console.log(policies);
|
|
85
|
+
ACConstants_1.ACConstants.DEBUG && console.log("END 'convertPolicies' function");
|
|
86
|
+
// In the case policies is an Array return it as engine expects list
|
|
87
|
+
if (policies instanceof Array) {
|
|
88
|
+
return policies;
|
|
89
|
+
}
|
|
90
|
+
// If the policies is string, we need to convert it to an array. Which includes comma seperated string support also
|
|
91
|
+
else if (typeof policies === "string") {
|
|
92
|
+
return policies.split(',');
|
|
93
|
+
}
|
|
94
|
+
return policies;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* This function is responsible processing the achecker config which was initialized to make sure it contains,
|
|
98
|
+
* information which matches what the engine reads.
|
|
99
|
+
*
|
|
100
|
+
* i.e.
|
|
101
|
+
* Need to change reportLevels and failLevels to match with level declerations in the engine.
|
|
102
|
+
* replace violation with level.violation
|
|
103
|
+
* Need to change array of policies into a string
|
|
104
|
+
* ["CI162_5_2_DCP070116","CI162_5_2_DCP070116"] to "CI162_5_2_DCP070116,CI162_5_2_DCP070116"
|
|
105
|
+
*
|
|
106
|
+
* @param {Object} ACConfig - Provide the config object in which needs to be processed.
|
|
107
|
+
*
|
|
108
|
+
* @return {Object} ACConfig - return the config object which has been made engine readable
|
|
109
|
+
*
|
|
110
|
+
* @memberOf this
|
|
111
|
+
*/
|
|
112
|
+
function processACConfig(ACConfig) {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
+
var ruleServer, ruleArchiveFile, ruleArchiveParse, err_1, ruleArchivePath, ruleArchive, i, errStr, errStr;
|
|
115
|
+
return __generator(this, function (_a) {
|
|
116
|
+
switch (_a.label) {
|
|
117
|
+
case 0:
|
|
118
|
+
ACConstants_1.ACConstants.DEBUG && console.log("START 'processACConfig' function");
|
|
119
|
+
// Convert the reportLevels and failLevels to match with what the engine provides
|
|
120
|
+
// Don't need to convert the levels from the input as we are going to compare with out the level.
|
|
121
|
+
// by using contains algo, so that in the reports we can add it without level, until the engine is
|
|
122
|
+
// updated to pass back with out level.
|
|
123
|
+
//ACConfig.reportLevels = mapLevelsToEngineReadableLevels(ACConfig.reportLevels);
|
|
124
|
+
//ACConfig.failLevels = mapLevelsToEngineReadableLevels(ACConfig.failLevels);
|
|
125
|
+
// Convert the policies into a comma seperated string
|
|
126
|
+
ACConfig.policies = convertPolicies(ACConfig.policies);
|
|
127
|
+
ruleServer = ACConfig.ruleServer ? ACConfig.ruleServer : ACConstants_1.ACConstants.ruleServer;
|
|
128
|
+
ruleArchiveFile = ruleServer + "/archives.json";
|
|
129
|
+
_a.label = 1;
|
|
130
|
+
case 1:
|
|
131
|
+
_a.trys.push([1, 3, , 4]);
|
|
132
|
+
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
133
|
+
request.get(ruleArchiveFile, function (error, response, body) {
|
|
134
|
+
if (error) {
|
|
135
|
+
reject(error);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
resolve(JSON.parse(body));
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
})];
|
|
142
|
+
case 2:
|
|
143
|
+
ruleArchiveParse = _a.sent();
|
|
144
|
+
return [3 /*break*/, 4];
|
|
145
|
+
case 3:
|
|
146
|
+
err_1 = _a.sent();
|
|
147
|
+
console.log(err_1);
|
|
148
|
+
throw new Error(err_1);
|
|
149
|
+
case 4:
|
|
150
|
+
ruleArchivePath = null;
|
|
151
|
+
if (ruleArchiveParse && ruleArchiveParse.length > 0) {
|
|
152
|
+
ACConstants_1.ACConstants.DEBUG && console.log("Found archiveFile: " + ruleArchiveFile);
|
|
153
|
+
ACConfig.ruleArchiveSet = ruleArchiveParse;
|
|
154
|
+
ruleArchive = ACConfig.ruleArchive;
|
|
155
|
+
ACConfig.ruleArchiveLabel = ACConfig.ruleArchive;
|
|
156
|
+
for (i = 0; i < ACConfig.ruleArchiveSet.length; i++) {
|
|
157
|
+
if (ruleArchive == ACConfig.ruleArchiveSet[i].id && !ACConfig.ruleArchiveSet[i].sunset) {
|
|
158
|
+
ruleArchivePath = ACConfig.ruleArchiveSet[i].path;
|
|
159
|
+
ACConfig.ruleArchiveLabel = ruleArchiveParse[i].name + " (" + ruleArchiveParse[i].id + ")";
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (!ruleArchivePath) {
|
|
164
|
+
errStr = "[ERROR] RuleArchiveInvalid: Make Sure correct rule archive is provided in the configuration file. More information is available in the README.md";
|
|
165
|
+
console.error(errStr);
|
|
166
|
+
throw new Error(errStr);
|
|
167
|
+
}
|
|
168
|
+
//}
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
errStr = "[ERROR] UnableToParseArchive: Archives are unable to be parse. Contact support team.";
|
|
172
|
+
console.error(errStr);
|
|
173
|
+
throw new Error(errStr);
|
|
174
|
+
}
|
|
175
|
+
// Build the new rulePack based of the baseA11yServerURL
|
|
176
|
+
ACConfig.rulePack = "" + ruleServer + ruleArchivePath + "/js";
|
|
177
|
+
ACConfig.ruleServer = ruleServer;
|
|
178
|
+
ACConstants_1.ACConstants.DEBUG && console.log("Built new rulePack: " + ACConfig.rulePack);
|
|
179
|
+
ACConstants_1.ACConstants.DEBUG && console.log("END 'processACConfig' function");
|
|
180
|
+
// Return the updated ACConfig object
|
|
181
|
+
return [2 /*return*/, ACConfig];
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* This function is responsible initializing all the default values for the configurations, in the case any
|
|
188
|
+
* of the config options are missing.
|
|
189
|
+
*
|
|
190
|
+
* @param {Object} config - Provide the config object in which we need to initialize the default values.
|
|
191
|
+
*
|
|
192
|
+
* @return {Object} config - return the config object which has all the default values, in the case
|
|
193
|
+
* some of the options are null or undefined.
|
|
194
|
+
*
|
|
195
|
+
* @memberOf this
|
|
196
|
+
*/
|
|
197
|
+
function initializeDefaults(config) {
|
|
198
|
+
ACConstants_1.ACConstants.DEBUG && console.log("START 'initializeDefaults' function");
|
|
199
|
+
ACConstants_1.ACConstants.DEBUG && console.log("Config before initialization: ");
|
|
200
|
+
ACConstants_1.ACConstants.DEBUG && console.log(config);
|
|
201
|
+
// Make sure all the following options are defined, otherwise reset them to default values.
|
|
202
|
+
config.ruleArchiveLabel = config.ruleArchiveLabel || ACConstants_1.ACConstants.ruleArchiveLabel || config.ruleArchive;
|
|
203
|
+
// For capture screenshots need to check for null or undefined and then set default otherwise it will evaluate the
|
|
204
|
+
// boolean which causes it to always comply with the default value and not user provided option
|
|
205
|
+
if (config.captureScreenshots === null || config.captureScreenshots === undefined || typeof config.captureScreenshots === "undefined") {
|
|
206
|
+
config.captureScreenshots = ACConstants_1.ACConstants.captureScreenshots;
|
|
207
|
+
}
|
|
208
|
+
// Load in the package.json file so that we can extract the module name and the version to build
|
|
209
|
+
// a toolID which needs to be used when results are build for the purpose of keeping track of
|
|
210
|
+
// which tool is uploading the results.
|
|
211
|
+
var packageObject = require('../package.json');
|
|
212
|
+
// Build the toolID based on name and version
|
|
213
|
+
config.toolID = packageObject.name + "-v" + packageObject.version;
|
|
214
|
+
// Using the uuid module generate a uuid number which is used to assoiciate to the scans that
|
|
215
|
+
// are done for a single run of karma.
|
|
216
|
+
config.scanID = uuid.v4();
|
|
217
|
+
for (var key in ACConstants_1.ACConstants) {
|
|
218
|
+
config[key] = config[key] || ACConstants_1.ACConstants[key];
|
|
219
|
+
}
|
|
220
|
+
ACConstants_1.ACConstants.DEBUG && console.log("Config after initialization: ");
|
|
221
|
+
ACConstants_1.ACConstants.DEBUG && console.log(config);
|
|
222
|
+
ACConstants_1.ACConstants.DEBUG && console.log("END 'initializeDefaults' function");
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* This function is responsible reading in the .yaml or .yml or .json and set the config options based on this.
|
|
226
|
+
*
|
|
227
|
+
* @return {Object} config - return the config object that was read in, refer to function initializeDefaults
|
|
228
|
+
* to view how the object is to be constructed.
|
|
229
|
+
*
|
|
230
|
+
* @memberOf this
|
|
231
|
+
*/
|
|
232
|
+
function loadConfigFromYAMLorJSONFile() {
|
|
233
|
+
ACConstants_1.ACConstants.DEBUG && console.log("START 'loadConfigFromYAMLorJSONFile' function");
|
|
234
|
+
// Variable Decleration
|
|
235
|
+
var config = {};
|
|
236
|
+
// Get the current working directory, where we will look for the yaml, yml or json file
|
|
237
|
+
var workingDir = process.cwd();
|
|
238
|
+
ACConstants_1.ACConstants.DEBUG && console.log("Working directory set to: " + workingDir);
|
|
239
|
+
// List of files to look for in that order, in the case even one is found we stop and load that as the config.
|
|
240
|
+
// Theses files will be checked for in the working directory:
|
|
241
|
+
// ./.achecker.yml
|
|
242
|
+
// ./.achecker.yaml
|
|
243
|
+
// ./achecker.js
|
|
244
|
+
// ./achecker.json
|
|
245
|
+
// ./.config/.achecker.yml
|
|
246
|
+
// ./.config/.achecker.yaml
|
|
247
|
+
// ./.config/achecker.js
|
|
248
|
+
// ./.config/achecker.json
|
|
249
|
+
// The node module, require will load js or json depending on which one is present, in the case
|
|
250
|
+
// both json and js are present it loads js first.
|
|
251
|
+
// Refer to ACConstants.js for more details
|
|
252
|
+
var configFiles = ACConstants_1.ACConstants.configFiles;
|
|
253
|
+
// Loop over all the possible location where the config file can reside, if one is found load it and break out.
|
|
254
|
+
for (var i = 0; i < configFiles.length; i++) {
|
|
255
|
+
// Get the full path to the config file we are going to check
|
|
256
|
+
var fileToCheck = pathLib.join(workingDir, configFiles[i]);
|
|
257
|
+
ACConstants_1.ACConstants.DEBUG && console.log("Checking file: " + fileToCheck);
|
|
258
|
+
// Get the extension of the file we are about to scan
|
|
259
|
+
var fileExtension = fileToCheck.substr(fileToCheck.lastIndexOf('.') + 1);
|
|
260
|
+
// If this is a yml or yaml file verify that the file exists and then load as such.
|
|
261
|
+
if (fileExtension === "yml" || fileExtension === "yaml") {
|
|
262
|
+
// Start checking which files exists, if it exists then load it as the config that was read in
|
|
263
|
+
// We only allow specifying a file, and the order it checks is based on what is specified in the array.
|
|
264
|
+
// i.e. So in the case that it finds yml, it will load and not check the rest, etc...
|
|
265
|
+
if (fs.existsSync(fileToCheck)) {
|
|
266
|
+
ACConstants_1.ACConstants.DEBUG && console.log("File: " + fileToCheck + " exists loading it.");
|
|
267
|
+
ACConstants_1.ACConstants.DEBUG && console.log("Loading as YAML file.");
|
|
268
|
+
// Load in as yml or yaml file and return this object
|
|
269
|
+
return YAML.safeLoad(fs.readFileSync(fileToCheck), 'utf8');
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
ACConstants_1.ACConstants.DEBUG && console.log("Trying to load as json or js.");
|
|
274
|
+
// Need to use try/catch mech so that in the case the require throws an exception, we can
|
|
275
|
+
// catch this and discatd the error, as in the case there is no config file provided then
|
|
276
|
+
// we load in default values.
|
|
277
|
+
try {
|
|
278
|
+
// call the resolve to check if the file exists or not, and get the actualy path if it was js or json
|
|
279
|
+
var jsOrJSONFile = require.resolve(fileToCheck);
|
|
280
|
+
// Only try to load the achecker js or json file if it exists.
|
|
281
|
+
if (jsOrJSONFile) {
|
|
282
|
+
ACConstants_1.ACConstants.DEBUG && console.log("Loading: " + jsOrJSONFile);
|
|
283
|
+
// Load in as json or js and return this object
|
|
284
|
+
return require(fileToCheck);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
catch (e) {
|
|
288
|
+
ACConstants_1.ACConstants.DEBUG && console.log("JSON or JS file does not exists, will load default config.");
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
ACConstants_1.ACConstants.DEBUG && console.log("END 'loadConfigFromYAMLorJSONFile' function");
|
|
293
|
+
return config;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* This function is responsible for processing the karma configuration for accessibility-checker.
|
|
297
|
+
* The ACConfig provided in the Karma configuration will be processed by this
|
|
298
|
+
* function and then the config variables will be assoiciated to the global space so that
|
|
299
|
+
* they can be accessed from window.__karma__.config
|
|
300
|
+
*
|
|
301
|
+
* @param {Object} config - All the Karma configuration, we will extract what we need from this over
|
|
302
|
+
* all object, we need the entire object so that we can reasign some config
|
|
303
|
+
* variables to global scope so that all karma testscases/scripts can access
|
|
304
|
+
* them.
|
|
305
|
+
*
|
|
306
|
+
* @return - N/A - Object will be processed and all the params that are needed for this module will
|
|
307
|
+
* be extracted and then the entire object will be added to global space.
|
|
308
|
+
*
|
|
309
|
+
* @memberOf this
|
|
310
|
+
*/
|
|
311
|
+
function processConfiguration(config) {
|
|
312
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
313
|
+
var ACConfig, configFromFile;
|
|
314
|
+
return __generator(this, function (_a) {
|
|
315
|
+
switch (_a.label) {
|
|
316
|
+
case 0:
|
|
317
|
+
ACConstants_1.ACConstants.DEBUG && console.log("START 'processConfiguration' function");
|
|
318
|
+
ACConfig = null;
|
|
319
|
+
configFromFile = null;
|
|
320
|
+
// Read in the .yaml (.yml) or .json file to load in the configuration
|
|
321
|
+
configFromFile = loadConfigFromYAMLorJSONFile();
|
|
322
|
+
ACConstants_1.ACConstants.DEBUG && console.log("Loaded config from file: ");
|
|
323
|
+
ACConstants_1.ACConstants.DEBUG && console.log(configFromFile);
|
|
324
|
+
// In the case configuration was provided in a yaml, yml or json file, then set this as the configuration
|
|
325
|
+
// otherwise load them from the Karma configuration.
|
|
326
|
+
if (configFromFile !== null && typeof (configFromFile) !== "undefined" && Object.keys(configFromFile).length !== 0) {
|
|
327
|
+
ACConstants_1.ACConstants.DEBUG && console.log("Using config which was loaded from config file.");
|
|
328
|
+
ACConfig = configFromFile;
|
|
329
|
+
}
|
|
330
|
+
else if (config !== null && typeof (config) !== "undefined" && Object.keys(config).length !== 0) {
|
|
331
|
+
// Extract the ACConfig from the overall karma configuration, in the case config file
|
|
332
|
+
// was not provided.
|
|
333
|
+
ACConfig = config;
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
ACConfig = JSON.parse(JSON.stringify(ACConstants_1.ACConstants));
|
|
337
|
+
}
|
|
338
|
+
// In the case the ACConfig object is not defined, then define it with default config options so
|
|
339
|
+
// it can be set in window.__karma__.config.ACConfig, so that we know even in the testcases, other
|
|
340
|
+
// wrapper scripts that there was nothing defined at all, and at the same time to make sure that this
|
|
341
|
+
// code was actually executed.
|
|
342
|
+
initializeDefaults(ACConfig);
|
|
343
|
+
// Now we process the final accessibility-checker config object that is build to make sure it is valid, also need to perform some
|
|
344
|
+
// mapping for provided paremeters to actualy read by the engine.
|
|
345
|
+
return [4 /*yield*/, processACConfig(ACConfig)];
|
|
346
|
+
case 1:
|
|
347
|
+
// Now we process the final accessibility-checker config object that is build to make sure it is valid, also need to perform some
|
|
348
|
+
// mapping for provided paremeters to actualy read by the engine.
|
|
349
|
+
_a.sent();
|
|
350
|
+
// In the case the Karma config is set to config.LOG_DEBUG then also enable the accessibility-checker debuging
|
|
351
|
+
ACConfig.DEBUG = ACConstants_1.ACConstants.DEBUG;
|
|
352
|
+
ACConstants_1.ACConstants.DEBUG && console.log("END 'processConfiguration' function");
|
|
353
|
+
return [2 /*return*/, ACConfig];
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
var config = null;
|
|
359
|
+
var ACConfigManager = /** @class */ (function () {
|
|
360
|
+
function ACConfigManager() {
|
|
361
|
+
}
|
|
362
|
+
ACConfigManager.setConfig = function (inConfig) {
|
|
363
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
364
|
+
return __generator(this, function (_a) {
|
|
365
|
+
switch (_a.label) {
|
|
366
|
+
case 0: return [4 /*yield*/, processConfiguration(inConfig)];
|
|
367
|
+
case 1:
|
|
368
|
+
config = _a.sent();
|
|
369
|
+
return [2 /*return*/];
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
});
|
|
373
|
+
};
|
|
374
|
+
ACConfigManager.getConfig = function () {
|
|
375
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
376
|
+
return __generator(this, function (_a) {
|
|
377
|
+
return [2 /*return*/, this.getConfigUnsupported()];
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
};
|
|
381
|
+
ACConfigManager.getConfigUnsupported = function () {
|
|
382
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
383
|
+
return __generator(this, function (_a) {
|
|
384
|
+
switch (_a.label) {
|
|
385
|
+
case 0:
|
|
386
|
+
if (!!config) return [3 /*break*/, 2];
|
|
387
|
+
return [4 /*yield*/, ACConfigManager.setConfig()];
|
|
388
|
+
case 1:
|
|
389
|
+
_a.sent();
|
|
390
|
+
_a.label = 2;
|
|
391
|
+
case 2: return [2 /*return*/, config];
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
};
|
|
396
|
+
return ACConfigManager;
|
|
397
|
+
}());
|
|
398
|
+
exports.ACConfigManager = ACConfigManager;
|
|
399
|
+
//# sourceMappingURL=ACConfigManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ACConfigManager.js","sourceRoot":"","sources":["../../src-ts/lib/ACConfigManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;gFAcgF;AAC/E,uCAAuC;AACxC,8BAAgC;AAChC,uBAAyB;AACzB,8BAAgC;AAChC,6CAA4C;AAC5C,2BAA6B;AAC7B,iCAAmC;AAGnC;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAS,eAAe,CAAC,QAA2B;IAChD,yBAAW,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;IAErE,yBAAW,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;IAC1E,yBAAW,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAE3C,yBAAW,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAEnE,oEAAoE;IACpE,IAAI,QAAQ,YAAY,KAAK,EAAE;QAC3B,OAAO,QAAQ,CAAC;KACnB;IACD,mHAAmH;SAC9G,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;QACnC,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KAC9B;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,SAAe,eAAe,CAAC,QAAQ;;;;;;oBACnC,yBAAW,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;oBAErE,iFAAiF;oBACjF,iGAAiG;o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AoB,CAAC,QAAQ,CAAC,EAAA;;wBAA7C,MAAM,GAAG,SAAoC,CAAC;;;;;KACjD;IAEY,yBAAS,GAAtB;;;gBACI,sBAAO,IAAI,CAAC,oBAAoB,EAAE,EAAC;;;KACtC;IAEY,oCAAoB,GAAjC;;;;;6BACQ,CAAC,MAAM,EAAP,wBAAO;wBACP,qBAAM,eAAe,CAAC,SAAS,EAAE,EAAA;;wBAAjC,SAAiC,CAAC;;4BAEtC,sBAAO,MAAM,EAAC;;;;KACjB;IACL,sBAAC;AAAD,CAAC,AAfD,IAeC;AAfY,0CAAe"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright:: 2020- IBM, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*****************************************************************************/
|
|
16
|
+
import { IConfigUnsupported } from "./api/IChecker";
|
|
17
|
+
export declare const ACConstants: IConfigUnsupported;
|
package/lib/ACConstants.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/******************************************************************************
|
|
2
3
|
Copyright:: 2020- IBM, Inc
|
|
3
4
|
|
|
@@ -13,62 +14,42 @@
|
|
|
13
14
|
See the License for the specific language governing permissions and
|
|
14
15
|
limitations under the License.
|
|
15
16
|
*****************************************************************************/
|
|
16
|
-
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ACConstants = void 0;
|
|
17
19
|
/*******************************************************************************
|
|
18
20
|
* NAME: ACConstants.js
|
|
19
21
|
* DESCRIPTION: Stores all the constants that are used by karma-ibma.
|
|
20
22
|
*******************************************************************************/
|
|
21
|
-
|
|
22
23
|
// Load all the modules that are needed
|
|
23
|
-
var pathLib = require(
|
|
24
|
-
|
|
24
|
+
var pathLib = require("path");
|
|
25
|
+
var IEngine_1 = require("./api/IEngine");
|
|
25
26
|
// Used to specify all the constant
|
|
26
|
-
|
|
27
|
+
exports.ACConstants = {
|
|
27
28
|
DEBUG: process.env.DEBUG === "true",
|
|
28
|
-
|
|
29
29
|
maxTabs: 1,
|
|
30
|
-
|
|
31
30
|
policies: ["IBM_Accessibility"],
|
|
32
|
-
|
|
33
31
|
// Specify the default rule pack server to use. (Where to pull the rules and engine from).
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
ruleServer: "https://able.ibm.com/rules",
|
|
36
33
|
//Specify the rule set to be use.
|
|
37
34
|
ruleArchive: "latest",
|
|
38
|
-
|
|
39
35
|
// Specify default violation levels on which to fail the test.
|
|
40
36
|
// i.e. If specified violation then the testcase will only fail if
|
|
41
37
|
// a violation is found uring the scan.
|
|
42
|
-
failLevels: [
|
|
43
|
-
|
|
38
|
+
failLevels: [IEngine_1.eRuleLevel.violation, IEngine_1.eRuleLevel.potentialviolation],
|
|
44
39
|
// Specify default violation levels which should be reported.
|
|
45
40
|
// i.e. If specified violation then in the report it would only contain
|
|
46
41
|
// results which are level of violation.
|
|
47
|
-
reportLevels: [
|
|
48
|
-
"potentialviolation"
|
|
49
|
-
],
|
|
50
|
-
|
|
42
|
+
reportLevels: [IEngine_1.eRuleLevel.violation, IEngine_1.eRuleLevel.potentialviolation],
|
|
51
43
|
// Specify default value if screenshoot should be captured of the current page that is being scanned.
|
|
52
44
|
captureScreenshots: false,
|
|
53
|
-
|
|
54
45
|
// Specify default value for which type should the results be outputted to
|
|
55
46
|
outputFormat: "json",
|
|
56
|
-
|
|
57
47
|
// Specify default location where the results should be saved
|
|
58
48
|
outputFolder: "results",
|
|
59
|
-
|
|
60
49
|
// Specify default location where the baselines should be saved
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
// Specify default value if Hidden content be scanned or not.
|
|
64
|
-
checkHiddenContent: false,
|
|
65
|
-
|
|
50
|
+
baselineFolder: "baselines",
|
|
66
51
|
// Specify default value for Which file extensions should be checked
|
|
67
52
|
extensions: ["html", "htm", "svg"],
|
|
68
|
-
|
|
69
|
-
// Specify default value for the engine file name. This the
|
|
70
|
-
engineFileName: "ace.js",
|
|
71
|
-
|
|
72
53
|
// List of files to look for in that order, in the case even one is found we stop and load that as the config.
|
|
73
54
|
// Theses files will be checked for in the working directory:
|
|
74
55
|
// ./.achecker.yml
|
|
@@ -82,13 +63,6 @@ var constants = {
|
|
|
82
63
|
// The node module, require will load js or json depending on which one is present, in the case
|
|
83
64
|
// both json and js are present it loads js first.
|
|
84
65
|
configFiles: [".achecker.yml", ".achecker.yaml", "achecker", pathLib.join(".config", ".achecker.yml"), pathLib.join(".config", ".achecker.yaml"), pathLib.join(".config", "achecker")],
|
|
85
|
-
|
|
86
|
-
// Specify the Base Accessibility Server URL
|
|
87
|
-
baseA11yServerURL: "https://able.ibm.com/rules",
|
|
88
|
-
|
|
89
|
-
// Specify true or false to allow setting rulePack with a custom server
|
|
90
|
-
customRuleServer: false
|
|
66
|
+
ignoreHTTPSErrors: false
|
|
91
67
|
};
|
|
92
|
-
|
|
93
|
-
// Export this the constants
|
|
94
|
-
module.exports = constants;
|
|
68
|
+
//# sourceMappingURL=ACConstants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ACConstants.js","sourceRoot":"","sources":["../../src-ts/lib/ACConstants.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;gFAcgF;;;AAEhF;;;iFAGiF;AAEjF,uCAAuC;AACvC,8BAAgC;AAEhC,yCAA2C;AAE3C,mCAAmC;AACtB,QAAA,WAAW,GAAwB;IAC5C,KA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|
+
static loadEngineLocal(): Promise<void>;
|
|
4
|
+
static isPuppeteer(content: any): any;
|
|
5
|
+
static isPlaywright(content: any): any;
|
|
6
|
+
static isSelenium(content: any): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* This function is responsible for building the full help file URL using rule server.
|
|
9
|
+
*
|
|
10
|
+
* @param {String} helpFileName - Provide the help file name
|
|
11
|
+
*
|
|
12
|
+
* @return {String} helpFileName - The full help file URL
|
|
13
|
+
*
|
|
14
|
+
* PRIVATE METHOD
|
|
15
|
+
*
|
|
16
|
+
* @memberOf this
|
|
17
|
+
*/
|
|
18
|
+
static getHelpURL(ruleId: any): any;
|
|
19
|
+
static getRulesets(): any;
|
|
20
|
+
static getChecker(): any;
|
|
21
|
+
}
|