accessibility-checker 3.1.49 → 3.1.51

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.
Files changed (94) hide show
  1. package/README.md +75 -67
  2. package/bin/achecker.js +14 -17
  3. package/bin/achecker.js.map +1 -1
  4. package/index.d.ts +6 -4
  5. package/index.js +9 -8
  6. package/index.js.map +1 -1
  7. package/lib/ACBrowserManager.d.ts +2 -2
  8. package/lib/ACBrowserManager.js +2 -3
  9. package/lib/ACBrowserManager.js.map +1 -1
  10. package/lib/ACEngineManager.d.ts +1 -12
  11. package/lib/ACEngineManager.js +72 -40
  12. package/lib/ACEngineManager.js.map +1 -1
  13. package/lib/ACHelper.js +126 -137
  14. package/lib/ACHelper.js.map +1 -1
  15. package/lib/api/IChecker.d.ts +3 -114
  16. package/lib/api/IChecker.js +1 -1
  17. package/lib/api/IChecker.js.map +1 -1
  18. package/lib/common/api-ext/Fetch.d.ts +16 -0
  19. package/lib/common/api-ext/Fetch.js +83 -0
  20. package/lib/common/api-ext/Fetch.js.map +1 -0
  21. package/lib/common/api-ext/IAbstractAPI.d.ts +34 -0
  22. package/lib/common/api-ext/IAbstractAPI.js +18 -0
  23. package/lib/common/api-ext/IAbstractAPI.js.map +1 -0
  24. package/lib/common/config/ACConfigManager.d.ts +7 -0
  25. package/lib/{ACConfigManager.js → common/config/ACConfigManager.js} +28 -19
  26. package/lib/common/config/ACConfigManager.js.map +1 -0
  27. package/lib/{ACConstants.d.ts → common/config/ACConstants.d.ts} +2 -2
  28. package/lib/{ACConstants.js → common/config/ACConstants.js} +7 -5
  29. package/lib/common/config/ACConstants.js.map +1 -0
  30. package/lib/common/config/IArchive.d.ts +37 -0
  31. package/lib/{reporters/multiScanReportUtil.d.ts → common/config/IArchive.js} +4 -5
  32. package/lib/common/config/IArchive.js.map +1 -0
  33. package/lib/common/config/IConfig.d.ts +146 -0
  34. package/lib/common/config/IConfig.js +36 -0
  35. package/lib/common/config/IConfig.js.map +1 -0
  36. package/lib/common/report/ACReporterCSV.d.ts +27 -0
  37. package/lib/common/report/ACReporterCSV.js +105 -0
  38. package/lib/common/report/ACReporterCSV.js.map +1 -0
  39. package/lib/common/report/ACReporterHTML.d.ts +26 -0
  40. package/lib/common/report/ACReporterHTML.js +94 -0
  41. package/lib/common/report/ACReporterHTML.js.map +1 -0
  42. package/lib/common/report/ACReporterJSON.d.ts +46 -0
  43. package/lib/common/report/ACReporterJSON.js +140 -0
  44. package/lib/common/report/ACReporterJSON.js.map +1 -0
  45. package/lib/{log/ACMetricsLogger.d.ts → common/report/ACReporterMetrics.d.ts} +11 -6
  46. package/lib/{log/ACMetricsLogger.js → common/report/ACReporterMetrics.js} +85 -70
  47. package/lib/common/report/ACReporterMetrics.js.map +1 -0
  48. package/lib/common/report/ACReporterXLSX.d.ts +37 -0
  49. package/lib/common/report/ACReporterXLSX.js +1004 -0
  50. package/lib/common/report/ACReporterXLSX.js.map +1 -0
  51. package/lib/common/report/BaselineManager.d.ts +169 -0
  52. package/lib/common/report/BaselineManager.js +355 -0
  53. package/lib/common/report/BaselineManager.js.map +1 -0
  54. package/lib/common/report/ReporterManager.d.ts +79 -0
  55. package/lib/common/report/ReporterManager.js +552 -0
  56. package/lib/common/report/ReporterManager.js.map +1 -0
  57. package/lib/common/report/genReport.js.map +1 -0
  58. package/package.json +1 -1
  59. package/lib/ACConfigManager.d.ts +0 -7
  60. package/lib/ACConfigManager.js.map +0 -1
  61. package/lib/ACConstants.js.map +0 -1
  62. package/lib/ACReportManager.d.ts +0 -590
  63. package/lib/ACReportManager.js +0 -1201
  64. package/lib/ACReportManager.js.map +0 -1
  65. package/lib/api/IEngine.d.ts +0 -129
  66. package/lib/api/IEngine.js +0 -110
  67. package/lib/api/IEngine.js.map +0 -1
  68. package/lib/log/ACMetricsLogger.js.map +0 -1
  69. package/lib/reporters/ACReporterCSV.d.ts +0 -103
  70. package/lib/reporters/ACReporterCSV.js +0 -193
  71. package/lib/reporters/ACReporterCSV.js.map +0 -1
  72. package/lib/reporters/ACReporterHTML.d.ts +0 -114
  73. package/lib/reporters/ACReporterHTML.js +0 -360
  74. package/lib/reporters/ACReporterHTML.js.map +0 -1
  75. package/lib/reporters/ACReporterJSON.d.ts +0 -114
  76. package/lib/reporters/ACReporterJSON.js +0 -277
  77. package/lib/reporters/ACReporterJSON.js.map +0 -1
  78. package/lib/reporters/ACReporterXLSX.d.ts +0 -109
  79. package/lib/reporters/ACReporterXLSX.js +0 -405
  80. package/lib/reporters/ACReporterXLSX.js.map +0 -1
  81. package/lib/reporters/ReportUtil.d.ts +0 -33
  82. package/lib/reporters/ReportUtil.js +0 -65
  83. package/lib/reporters/ReportUtil.js.map +0 -1
  84. package/lib/reporters/genReport.js.map +0 -1
  85. package/lib/reporters/multiScanData.d.ts +0 -27
  86. package/lib/reporters/multiScanData.js +0 -190
  87. package/lib/reporters/multiScanData.js.map +0 -1
  88. package/lib/reporters/multiScanReport.d.ts +0 -25
  89. package/lib/reporters/multiScanReport.js +0 -1729
  90. package/lib/reporters/multiScanReport.js.map +0 -1
  91. package/lib/reporters/multiScanReportUtil.js +0 -49
  92. package/lib/reporters/multiScanReportUtil.js.map +0 -1
  93. /package/lib/{reporters → common/report}/genReport.d.ts +0 -0
  94. /package/lib/{reporters → common/report}/genReport.js +0 -0
@@ -1,114 +0,0 @@
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
- import { IScanSummary } from "./ReportUtil";
18
- /**
19
- * This function is responsible for constructing the aChecker Reporter which will be used to, report
20
- * the scan results, such as writing the page results and the summary to a HTML file. This reporter function
21
- * is registered with Karma server and triggered based on events that are triggered by the karma communication.
22
- *
23
- * @param {Object} baseReporterDecorator - the base karma reporter, which had the base functions which we override
24
- * @param {Object} this.Config - All the Karma this.Configuration, we will extract what we need from this over
25
- * all object, we need the entire object so that we detect any changes in the object
26
- * as other plugins are loaded and the object is updated dynamically.
27
- * @param {Object} logger - logger object which is used to log debug/error/info messages
28
- * @param {Object} emitter - emitter object which allows to listem on any event that is triggered and allow to execute
29
- * custom code, to handle the event that was triggered.
30
- *
31
- * @return - N/A
32
- *
33
- * @memberOf this
34
- */
35
- export declare class ACReporterHTML {
36
- Config: IConfigUnsupported;
37
- scanSummary: IScanSummary;
38
- constructor(config: IConfigUnsupported, scanSummary: IScanSummary);
39
- report(info: any): Promise<void>;
40
- /**
41
- * This function is responsible for performing any action when the entire karma run is done.
42
- * Overrides onRunComplete function from baseReporterDecorator
43
- *
44
- * @override
45
- *
46
- * @memberOf this
47
- */
48
- onRunComplete(): void;
49
- /**
50
- * This function is responsible for indexing the results into global spaces based on label.
51
- *
52
- * @param {Object} results - Results object which will be provided to the user/wroten to the file.
53
- * Refer to aChecker.buildReport function's return to figure out what the object
54
- * will look like.
55
- *
56
- * @return - N/A - Global object is updated with the results
57
- *
58
- * @memberOf this
59
- */
60
- addResultsToGlobal(results: any): void;
61
- /**
62
- * This function is responsible for updating/creating the global violation summary for the engine karma run
63
- * for browser that it is running on. Will take the pageCount object which is part of the page object and
64
- * add extract the values for each of the levels and add them to the global object. This will provide an overall
65
- * summary of violations for all testcases run and all scans done.
66
- *
67
- * @param {Object} pageCount - Provide the page count object, in the following format:
68
- *
69
- * @return N/A - Global summary object is updated with the counts
70
- *
71
- * @memberOf this
72
- */
73
- addToSummaryCount: (pageCount: any) => void;
74
- /**
75
- * This function is responsible for saving a single scans results to a file as HTML. On a side note
76
- * this function will also extract the label which will be the file names where the results will be
77
- * saved.
78
- *
79
- * @param {Object} this.Config - Karma this.Config object, used to extrat the outputFolder from the ACthis.Config.
80
- * @param {Object} results - Provide the scan results for a single page that should be saved.
81
- *
82
- * @memberOf this
83
- */
84
- savePageResults(results: any): Promise<void>;
85
- /**
86
- * This function is responsible for converting a javascript object into HTML and then writing that to a
87
- * json file.
88
- *
89
- * @param {String} fileName - Full path of file where the HTML object should be stored
90
- * @param {String} content - The javascript object which should be converted and saved to file as HTML.
91
- *
92
- * @memberOf this
93
- */
94
- writeObjectToFileAsHTML(fileName: any, content: any): Promise<void>;
95
- /**
96
- * This function is responsible for saving the summary object of the while scan to a summary file.
97
- *
98
- * @param {Object} summary - The summary object that needs to be written to the summary file.
99
- *
100
- * @memberOf this
101
- */
102
- saveSummary(summary: any): void;
103
- /**
104
- * This function is responsible for checking if a number needs a leading 0, and if it is needed
105
- * add the leading 0 and return that as the new number.
106
- *
107
- * @param {int} number - Provide a number to check if a leading 0 needs to be added or not.
108
- *
109
- * @return {String} number - Return the number with the leading 0 added back
110
- *
111
- * @memberOf this
112
- */
113
- datePadding(number: any): any;
114
- }
@@ -1,360 +0,0 @@
1
- "use strict";
2
- /******************************************************************************
3
- Copyright:: 2020- IBM, Inc
4
-
5
- Licensed under the Apache License, Version 2.0 (the "License");
6
- you may not use this file except in compliance with the License.
7
- You may obtain a copy of the License at
8
-
9
- http://www.apache.org/licenses/LICENSE-2.0
10
-
11
- Unless required by applicable law or agreed to in writing, software
12
- distributed under the License is distributed on an "AS IS" BASIS,
13
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- See the License for the specific language governing permissions and
15
- limitations under the License.
16
- *****************************************************************************/
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
- 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;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
- Object.defineProperty(exports, "__esModule", { value: true });
54
- exports.ACReporterHTML = void 0;
55
- // Load all the modules that are needed
56
- var pathLib = require("path");
57
- var fs = require("fs");
58
- var ACEngineManager_1 = require("../ACEngineManager");
59
- var genReport_1 = require("./genReport");
60
- /**
61
- * This function is responsible for constructing the aChecker Reporter which will be used to, report
62
- * the scan results, such as writing the page results and the summary to a HTML file. This reporter function
63
- * is registered with Karma server and triggered based on events that are triggered by the karma communication.
64
- *
65
- * @param {Object} baseReporterDecorator - the base karma reporter, which had the base functions which we override
66
- * @param {Object} this.Config - All the Karma this.Configuration, we will extract what we need from this over
67
- * all object, we need the entire object so that we detect any changes in the object
68
- * as other plugins are loaded and the object is updated dynamically.
69
- * @param {Object} logger - logger object which is used to log debug/error/info messages
70
- * @param {Object} emitter - emitter object which allows to listem on any event that is triggered and allow to execute
71
- * custom code, to handle the event that was triggered.
72
- *
73
- * @return - N/A
74
- *
75
- * @memberOf this
76
- */
77
- var ACReporterHTML = /** @class */ (function () {
78
- function ACReporterHTML(config, scanSummary) {
79
- /**
80
- * This function is responsible for updating/creating the global violation summary for the engine karma run
81
- * for browser that it is running on. Will take the pageCount object which is part of the page object and
82
- * add extract the values for each of the levels and add them to the global object. This will provide an overall
83
- * summary of violations for all testcases run and all scans done.
84
- *
85
- * @param {Object} pageCount - Provide the page count object, in the following format:
86
- *
87
- * @return N/A - Global summary object is updated with the counts
88
- *
89
- * @memberOf this
90
- */
91
- this.addToSummaryCount = function (pageCount) {
92
- // Variable Decleration
93
- var ACScanSummary = this.scanSummary.counts || {};
94
- var addedToSummary = false;
95
- // In the case ACScanSummary is empty, simply assign pageCount to ACScanSummary
96
- if (Object.keys(ACScanSummary).length === 0) {
97
- // Set pageCount as the summary count
98
- ACScanSummary = pageCount;
99
- addedToSummary = true;
100
- }
101
- // In the case that this is not first scan, handle adding up the summary
102
- if (!addedToSummary) {
103
- // Go through the pageCount object and for each of the levels, extract the value
104
- // and add it to the aChecker violation summary object.
105
- // This will keep track of an overall summary of the violations for all testscases, that
106
- // were run for a single karma run.
107
- for (var level in pageCount) {
108
- ACScanSummary[level] += pageCount[level];
109
- }
110
- }
111
- // Assign the new violation summary back to the global object
112
- this.scanSummary.counts = ACScanSummary;
113
- };
114
- this.scanSummary = JSON.parse(JSON.stringify(scanSummary));
115
- this.Config = config;
116
- this.Config.DEBUG && console.log("START ACReporter Constructor");
117
- var myThis = this;
118
- if (typeof (after) !== "undefined") {
119
- after(function (done) {
120
- myThis.onRunComplete();
121
- done && done();
122
- });
123
- }
124
- else {
125
- process.on('beforeExit', function () {
126
- myThis.onRunComplete();
127
- });
128
- }
129
- this.Config.DEBUG && console.log("END ACReporter Constructor");
130
- }
131
- // This emitter function is responsible for calling this function when the info event is detected
132
- ACReporterHTML.prototype.report = function (info) {
133
- return __awaiter(this, void 0, void 0, function () {
134
- return __generator(this, function (_a) {
135
- switch (_a.label) {
136
- case 0:
137
- this.Config.DEBUG && console.log("START 'info' emitter function");
138
- // Save the results of a single scan to a HTML file based on the label provided
139
- return [4 /*yield*/, this.savePageResults(info)];
140
- case 1:
141
- // Save the results of a single scan to a HTML file based on the label provided
142
- _a.sent();
143
- // Update the overall summary object count object to include the new scan that was performed
144
- this.addToSummaryCount(info.summary.counts);
145
- // Save the summary of this scan into global space of this reporter, to be logged
146
- // once the whole scan is done.
147
- this.addResultsToGlobal(info);
148
- this.Config.DEBUG && console.log("END 'info' emitter function");
149
- return [2 /*return*/];
150
- }
151
- });
152
- });
153
- };
154
- ;
155
- /**
156
- * This function is responsible for performing any action when the entire karma run is done.
157
- * Overrides onRunComplete function from baseReporterDecorator
158
- *
159
- * @override
160
- *
161
- * @memberOf this
162
- */
163
- ACReporterHTML.prototype.onRunComplete = function () {
164
- this.Config.DEBUG && console.log("START 'ACReporterHTML:onRunComplete' function");
165
- // Add End time when the whole karma run is done
166
- // End time will be in milliseconds elapsed since 1 January 1970 00:00:00 UTC up until now.
167
- this.scanSummary.endReport = Date.now();
168
- // Save summary object to a HTML file.
169
- this.saveSummary(this.scanSummary);
170
- this.Config.DEBUG && console.log("END 'ACReporterHTML:onRunComplete' function");
171
- };
172
- ;
173
- /**
174
- * This function is responsible for indexing the results into global spaces based on label.
175
- *
176
- * @param {Object} results - Results object which will be provided to the user/wroten to the file.
177
- * Refer to aChecker.buildReport function's return to figure out what the object
178
- * will look like.
179
- *
180
- * @return - N/A - Global object is updated with the results
181
- *
182
- * @memberOf this
183
- */
184
- ACReporterHTML.prototype.addResultsToGlobal = function (results) {
185
- this.Config.DEBUG && console.log("START 'addResultsToGlobal' function");
186
- // Build the single page summary object to follow the following format:
187
- // "label": "dependencies/tools-rules-html/v2/a11y/test/g471/Table-DataNoSummaryARIA.html",
188
- // "counts": {
189
- // "violation": 1,
190
- // "potentialviolation": 0,
191
- // "recommendation": 0,
192
- // "potentialrecommendation": 0,
193
- // "manual": 0
194
- // }
195
- var pageSummaryObject = {
196
- label: results.label,
197
- counts: results.summary.counts
198
- };
199
- this.Config.DEBUG && console.log("Adding following object to scanSummary.pageScanSummary: ");
200
- this.Config.DEBUG && console.log(pageSummaryObject);
201
- // Add the summary count for this scan to the pageScanSummary object which is in the global space
202
- // Index this by the label.
203
- this.scanSummary.pageScanSummary.push(pageSummaryObject);
204
- this.Config.DEBUG && console.log("END 'addResultsToGlobal' function");
205
- };
206
- /**
207
- * This function is responsible for saving a single scans results to a file as HTML. On a side note
208
- * this function will also extract the label which will be the file names where the results will be
209
- * saved.
210
- *
211
- * @param {Object} this.Config - Karma this.Config object, used to extrat the outputFolder from the ACthis.Config.
212
- * @param {Object} results - Provide the scan results for a single page that should be saved.
213
- *
214
- * @memberOf this
215
- */
216
- ACReporterHTML.prototype.savePageResults = function (results) {
217
- return __awaiter(this, void 0, void 0, function () {
218
- var resultDir, resultsFileName;
219
- return __generator(this, function (_a) {
220
- switch (_a.label) {
221
- case 0:
222
- this.Config.DEBUG && console.log("START 'savePageResults' function");
223
- resultDir = this.Config.outputFolder;
224
- this.Config.DEBUG && console.log("Results are going to be stored under results directory: \"" + resultDir + "\"");
225
- resultsFileName = pathLib.join(resultDir, results.label.replace(/[:?&=]/g, "_") + '.html');
226
- /**************************************************** DEBUG INFORMATION ***************************************************************
227
- // Debug example which has label which has unix "/" in them.
228
- let resultsFileName = pathLib.join(resultDir, "dependencies/tools-rules-html/v2/a11y/test/g471/Table-layoutMultiple.html.json");
229
-
230
- // Debug example which has a label which has Windows "\" in them.
231
- let resultsFileName = pathLib.join(resultDir, "dependencies\\tools-rules-html\\v2\\a11y\\test\\g471\\Table-layoutMultiple.html.json");
232
- ***************************************************************************************************************************************/
233
- // Write the results object as HTML to a file.
234
- return [4 /*yield*/, this.writeObjectToFileAsHTML(resultsFileName, results)];
235
- case 1:
236
- /**************************************************** DEBUG INFORMATION ***************************************************************
237
- // Debug example which has label which has unix "/" in them.
238
- let resultsFileName = pathLib.join(resultDir, "dependencies/tools-rules-html/v2/a11y/test/g471/Table-layoutMultiple.html.json");
239
-
240
- // Debug example which has a label which has Windows "\" in them.
241
- let resultsFileName = pathLib.join(resultDir, "dependencies\\tools-rules-html\\v2\\a11y\\test\\g471\\Table-layoutMultiple.html.json");
242
- ***************************************************************************************************************************************/
243
- // Write the results object as HTML to a file.
244
- _a.sent();
245
- this.Config.DEBUG && console.log("END 'savePageResults' function");
246
- return [2 /*return*/];
247
- }
248
- });
249
- });
250
- };
251
- /**
252
- * This function is responsible for converting a javascript object into HTML and then writing that to a
253
- * json file.
254
- *
255
- * @param {String} fileName - Full path of file where the HTML object should be stored
256
- * @param {String} content - The javascript object which should be converted and saved to file as HTML.
257
- *
258
- * @memberOf this
259
- */
260
- ACReporterHTML.prototype.writeObjectToFileAsHTML = function (fileName, content) {
261
- return __awaiter(this, void 0, void 0, function () {
262
- var valueMap, parentDir, passResults, passXpaths, outReport, _i, _a, item, val;
263
- var _b;
264
- return __generator(this, function (_c) {
265
- switch (_c.label) {
266
- case 0:
267
- valueMap = {
268
- "VIOLATION": {
269
- "POTENTIAL": "Needs review",
270
- "FAIL": "Violation",
271
- "PASS": "Pass",
272
- "MANUAL": "Needs review"
273
- },
274
- "RECOMMENDATION": {
275
- "POTENTIAL": "Recommendation",
276
- "FAIL": "Recommendation",
277
- "PASS": "Pass",
278
- "MANUAL": "Recommendation"
279
- }
280
- };
281
- this.Config.DEBUG && console.log("START 'writeObjectToFileAsHTML' function");
282
- parentDir = pathLib.dirname(fileName);
283
- this.Config.DEBUG && console.log("Parent Directoy: \"" + parentDir + "\"");
284
- // In the case that the parent directoy does not exist, create the directories
285
- if (!fs.existsSync(parentDir)) {
286
- // Create the parent directory recerseivly if it does not exist.
287
- fs.mkdirSync(parentDir, { recursive: true });
288
- }
289
- this.Config.DEBUG && console.log("Object will be written to file: \"" + fileName + "\"");
290
- passResults = content.results.filter(function (result) {
291
- return result.value[1] === "PASS";
292
- });
293
- passXpaths = passResults.map(function (result) { return result.path.dom; });
294
- _b = {
295
- report: {
296
- timestamp: content.summary.startScan,
297
- nls: content.nls,
298
- results: content.results.filter(function (issue) { return issue.value[1] !== "PASS"; }),
299
- passUniqueElements: Array.from(new Set(passXpaths)),
300
- counts: {
301
- total: {
302
- All: 0
303
- }
304
- }
305
- }
306
- };
307
- return [4 /*yield*/, ACEngineManager_1.ACEngineManager.getRulesets()];
308
- case 1:
309
- outReport = (_b.rulesets = _c.sent(),
310
- _b.tabURL = content.summary.URL,
311
- _b);
312
- for (_i = 0, _a = content.results; _i < _a.length; _i++) {
313
- item = _a[_i];
314
- val = valueMap[item.value[0]][item.value[1]] || item.value[0] + "_" + item.value[1];
315
- outReport.report.counts.total[val] = (outReport.report.counts.total[val] || 0) + 1;
316
- ++outReport.report.counts.total.All;
317
- item.help = ACEngineManager_1.ACEngineManager.getHelpURL(item);
318
- }
319
- // Convert the Object into HTML string and write that to the file
320
- // Make sure to use utf-8 encoding to avoid an issues specify to OS.
321
- // In terms of the HTML string that is constructed use 4 spaces to format the HTML object, before
322
- // writing it to the file.
323
- fs.writeFileSync(fileName, (0, genReport_1.genReport)(outReport), { encoding: 'utf-8' });
324
- this.Config.DEBUG && console.log("END 'writeObjectToFileAsHTML' function");
325
- return [2 /*return*/];
326
- }
327
- });
328
- });
329
- };
330
- /**
331
- * This function is responsible for saving the summary object of the while scan to a summary file.
332
- *
333
- * @param {Object} summary - The summary object that needs to be written to the summary file.
334
- *
335
- * @memberOf this
336
- */
337
- ACReporterHTML.prototype.saveSummary = function (summary) {
338
- };
339
- /**
340
- * This function is responsible for checking if a number needs a leading 0, and if it is needed
341
- * add the leading 0 and return that as the new number.
342
- *
343
- * @param {int} number - Provide a number to check if a leading 0 needs to be added or not.
344
- *
345
- * @return {String} number - Return the number with the leading 0 added back
346
- *
347
- * @memberOf this
348
- */
349
- ACReporterHTML.prototype.datePadding = function (number) {
350
- this.Config.DEBUG && console.log("START 'datePadding' function");
351
- // In the case that the number is less then 10 we need to add the leading '0' to the number.
352
- number = number < 10 ? '0' + number : number;
353
- this.Config.DEBUG && console.log("END 'datePadding' function");
354
- return number;
355
- };
356
- return ACReporterHTML;
357
- }());
358
- exports.ACReporterHTML = ACReporterHTML;
359
- ;
360
- //# sourceMappingURL=ACReporterHTML.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ACReporterHTML.js","sourceRoot":"","sources":["../../../src-ts/lib/reporters/ACReporterHTML.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;gFAcgF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhF,uCAAuC;AACvC,8BAAgC;AAChC,uBAAyB;AACzB,sDAAqD;AAGrD,yCAAwC;AAIxC;;;;;;;;;;;;;;;;GAgBG;AACH;IAII,wBAAY,MAA0B,EAAE,WAAyB;QA+FjE;;;;;;;;;;;WAWG;QACH,sBAAiB,GAAG,UAAU,SAAS;YACnC,uBAAuB;YACvB,IAAI,aAAa,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,IAAI,EAAE,CAAC;YAClD,IAAI,cAAc,GAAG,KAAK,CAAC;YAE3B,+EAA+E;YAC/E,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;gBAEzC,qCAAqC;g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AC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;;;;;KAC9E;IAED;;;;;;OAMG;IACH,oCAAW,GAAX,UAAY,OAAO;IAEnB,CAAC;IAED;;;;;;;;;OASG;IACH,oCAAW,GAAX,UAAY,MAAM;QACd,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;QAEjE,4FAA4F;QAC5F,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;QAE7C,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;QAE/D,OAAO,MAAM,CAAC;IAClB,CAAC;IACL,qBAAC;AAAD,CAAC,AA5RD,IA4RC;AA5RY,wCAAc;AA4R1B,CAAC"}
@@ -1,114 +0,0 @@
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
- import { IScanSummary } from "./ReportUtil";
18
- /**
19
- * This function is responsible for constructing the aChecker Reporter which will be used to, report
20
- * the scan results, such as writing the page results and the summary to a JSON file. This reporter function
21
- * is registered with Karma server and triggered based on events that are triggered by the karma communication.
22
- *
23
- * @param {Object} baseReporterDecorator - the base karma reporter, which had the base functions which we override
24
- * @param {Object} config - All the Karma configuration, we will extract what we need from this over
25
- * all object, we need the entire object so that we detect any changes in the object
26
- * as other plugins are loaded and the object is updated dynamically.
27
- * @param {Object} logger - logger object which is used to log debug/error/info messages
28
- * @param {Object} emitter - emitter object which allows to listem on any event that is triggered and allow to execute
29
- * custom code, to handle the event that was triggered.
30
- *
31
- * @return - N/A
32
- *
33
- * @memberOf this
34
- */
35
- export declare class ACReporterJSON {
36
- Config: IConfigUnsupported;
37
- scanSummary: IScanSummary;
38
- constructor(Config: IConfigUnsupported, scanSummary: IScanSummary);
39
- report(info: any): void;
40
- /**
41
- * This function is responsible for performing any action when the entire karma run is done.
42
- * Overrides onRunComplete function from baseReporterDecorator
43
- *
44
- * @override
45
- *
46
- * @memberOf this
47
- */
48
- onRunComplete(): void;
49
- /**
50
- * This function is responsible for saving a single scans results to a file as JSON. On a side note
51
- * this function will also extract the label which will be the file names where the results will be
52
- * saved.
53
- *
54
- * @param {Object} config - Karma config object, used to extrat the outputFolder from the ACConfig.
55
- * @param {Object} results - Provide the scan results for a single page that should be saved.
56
- *
57
- * @memberOf this
58
- */
59
- savePageResults(results: any): void;
60
- /**
61
- * This function is responsible for converting a javascript object into JSON and then writing that to a
62
- * json file.
63
- *
64
- * @param {String} fileName - Full path of file where the JSON object should be stored
65
- * @param {String} content - The javascript object which should be converted and saved to file as JSON.
66
- *
67
- * @memberOf this
68
- */
69
- writeObjectToFileAsJSON(fileName: any, content: any): void;
70
- /**
71
- * This function is responsible for saving the summary object of the while scan to a summary file.
72
- *
73
- * @param {Object} summary - The summary object that needs to be written to the summary file.
74
- *
75
- * @memberOf this
76
- */
77
- saveSummary(summary: any): void;
78
- /**
79
- * This function is responsible for checking if a number needs a leading 0, and if it is needed
80
- * add the leading 0 and return that as the new number.
81
- *
82
- * @param {int} number - Provide a number to check if a leading 0 needs to be added or not.
83
- *
84
- * @return {String} number - Return the number with the leading 0 added back
85
- *
86
- * @memberOf this
87
- */
88
- datePadding(number: any): any;
89
- /**
90
- * This function is responsible for indexing the results into global spaces based on label.
91
- *
92
- * @param {Object} results - Results object which will be provided to the user/wroten to the file.
93
- * Refer to aChecker.buildReport function's return to figure out what the object
94
- * will look like.
95
- *
96
- * @return - N/A - Global object is updated with the results
97
- *
98
- * @memberOf this
99
- */
100
- addResultsToGlobal(results: any): void;
101
- /**
102
- * This function is responsible for updating/creating the global violation summary for the engine karma run
103
- * for browser that it is running on. Will take the pageCount object which is part of the page object and
104
- * add extract the values for each of the levels and add them to the global object. This will provide an overall
105
- * summary of violations for all testcases run and all scans done.
106
- *
107
- * @param {Object} pageCount - Provide the page count object, in the following format:
108
- *
109
- * @return N/A - Global summary object is updated with the counts
110
- *
111
- * @memberOf this
112
- */
113
- addToSummaryCount(pageCount: any): void;
114
- }