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.
Files changed (54) hide show
  1. package/README.md +3 -2
  2. package/bin/achecker.d.ts +2 -0
  3. package/bin/achecker.js +293 -177
  4. package/bin/achecker.js.map +1 -0
  5. package/index.d.ts +317 -0
  6. package/index.js +359 -13
  7. package/index.js.map +1 -0
  8. package/lib/ACBrowserManager.d.ts +22 -0
  9. package/lib/ACBrowserManager.js +237 -0
  10. package/lib/ACBrowserManager.js.map +1 -0
  11. package/lib/ACConfigManager.d.ts +6 -0
  12. package/lib/ACConfigManager.js +399 -0
  13. package/lib/ACConfigManager.js.map +1 -0
  14. package/lib/ACConstants.d.ts +17 -0
  15. package/lib/ACConstants.js +12 -38
  16. package/lib/ACConstants.js.map +1 -0
  17. package/lib/ACEngineManager.d.ts +21 -0
  18. package/lib/ACEngineManager.js +220 -0
  19. package/lib/ACEngineManager.js.map +1 -0
  20. package/lib/ACHelper.d.ts +2 -0
  21. package/lib/ACHelper.js +485 -2085
  22. package/lib/ACHelper.js.map +1 -0
  23. package/lib/ACReportManager.d.ts +586 -0
  24. package/lib/ACReportManager.js +1150 -0
  25. package/lib/ACReportManager.js.map +1 -0
  26. package/lib/api/IChecker.d.ts +131 -0
  27. package/lib/api/IChecker.js +11 -0
  28. package/lib/api/IChecker.js.map +1 -0
  29. package/lib/api/IEngine.d.ts +124 -0
  30. package/lib/api/IEngine.js +110 -0
  31. package/lib/api/IEngine.js.map +1 -0
  32. package/lib/api/IMapper.d.ts +37 -0
  33. package/lib/api/IMapper.js +18 -0
  34. package/lib/api/IMapper.js.map +1 -0
  35. package/lib/log/ACMetricsLogger.d.ts +67 -0
  36. package/lib/log/ACMetricsLogger.js +40 -66
  37. package/lib/log/ACMetricsLogger.js.map +1 -0
  38. package/lib/reporters/ACReporterCSV.d.ts +103 -0
  39. package/lib/reporters/ACReporterCSV.js +83 -152
  40. package/lib/reporters/ACReporterCSV.js.map +1 -0
  41. package/lib/reporters/ACReporterHTML.d.ts +114 -0
  42. package/lib/reporters/ACReporterHTML.js +150 -293
  43. package/lib/reporters/ACReporterHTML.js.map +1 -0
  44. package/lib/reporters/ACReporterJSON.d.ts +114 -0
  45. package/lib/reporters/ACReporterJSON.js +95 -249
  46. package/lib/reporters/ACReporterJSON.js.map +1 -0
  47. package/lib/reporters/ReportUtil.d.ts +33 -0
  48. package/lib/reporters/ReportUtil.js +65 -0
  49. package/lib/reporters/ReportUtil.js.map +1 -0
  50. package/lib/reporters/genReport.d.ts +1 -0
  51. package/lib/reporters/genReport.js +13 -11
  52. package/lib/reporters/genReport.js.map +1 -0
  53. package/package.json +4 -3
  54. package/lib/ACConfigLoader.js +0 -358
@@ -0,0 +1,114 @@
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): 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): 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): 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,3 +1,4 @@
1
+ "use strict";
1
2
  /******************************************************************************
2
3
  Copyright:: 2020- IBM, Inc
3
4
 
@@ -13,23 +14,20 @@
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.ACReporterHTML = void 0;
17
19
  // Load all the modules that are needed
18
- var pathLib = require('path');
19
- var fs = require('fs');
20
- require("../ACConfigLoader");
21
- const { genReport } = require("./genReport");
22
-
23
- // Global aChecker Summary Holder
24
- var scanSummary = {};
25
-
20
+ var pathLib = require("path");
21
+ var fs = require("fs");
22
+ var ACEngineManager_1 = require("../ACEngineManager");
23
+ var genReport_1 = require("./genReport");
26
24
  /**
27
25
  * This function is responsible for constructing the aChecker Reporter which will be used to, report
28
26
  * the scan results, such as writing the page results and the summary to a HTML file. This reporter function
29
27
  * is registered with Karma server and triggered based on events that are triggered by the karma communication.
30
28
  *
31
29
  * @param {Object} baseReporterDecorator - the base karma reporter, which had the base functions which we override
32
- * @param {Object} config - All the Karma configuration, we will extract what we need from this over
30
+ * @param {Object} this.Config - All the Karma this.Configuration, we will extract what we need from this over
33
31
  * all object, we need the entire object so that we detect any changes in the object
34
32
  * as other plugins are loaded and the object is updated dynamically.
35
33
  * @param {Object} logger - logger object which is used to log debug/error/info messages
@@ -40,29 +38,73 @@ var scanSummary = {};
40
38
  *
41
39
  * @memberOf this
42
40
  */
43
- var ACReporterHTML = function (aChecker) {
44
- let Config = aChecker.Config;
45
- Config.DEBUG && console.log("START ACReporter Constructor");
46
- // Override adapters
47
- this.adapters = [];
48
-
41
+ var ACReporterHTML = /** @class */ (function () {
42
+ function ACReporterHTML(config, scanSummary) {
43
+ /**
44
+ * This function is responsible for updating/creating the global violation summary for the engine karma run
45
+ * for browser that it is running on. Will take the pageCount object which is part of the page object and
46
+ * add extract the values for each of the levels and add them to the global object. This will provide an overall
47
+ * summary of violations for all testcases run and all scans done.
48
+ *
49
+ * @param {Object} pageCount - Provide the page count object, in the following format:
50
+ *
51
+ * @return N/A - Global summary object is updated with the counts
52
+ *
53
+ * @memberOf this
54
+ */
55
+ this.addToSummaryCount = function (pageCount) {
56
+ // Variable Decleration
57
+ var ACScanSummary = this.scanSummary.counts || {};
58
+ var addedToSummary = false;
59
+ // In the case ACScanSummary is empty, simply assign pageCount to ACScanSummary
60
+ if (Object.keys(ACScanSummary).length === 0) {
61
+ // Set pageCount as the summary count
62
+ ACScanSummary = pageCount;
63
+ addedToSummary = true;
64
+ }
65
+ // In the case that this is not first scan, handle adding up the summary
66
+ if (!addedToSummary) {
67
+ // Go through the pageCount object and for each of the levels, extract the value
68
+ // and add it to the aChecker violation summary object.
69
+ // This will keep track of an overall summary of the violations for all testscases, that
70
+ // were run for a single karma run.
71
+ for (var level in pageCount) {
72
+ ACScanSummary[level] += pageCount[level];
73
+ }
74
+ }
75
+ // Assign the new violation summary back to the global object
76
+ this.scanSummary.counts = ACScanSummary;
77
+ };
78
+ this.scanSummary = scanSummary;
79
+ this.Config = config;
80
+ this.Config.DEBUG && console.log("START ACReporter Constructor");
81
+ var myThis = this;
82
+ if (typeof (after) !== "undefined") {
83
+ after(function (done) {
84
+ myThis.onRunComplete();
85
+ done && done();
86
+ });
87
+ }
88
+ else {
89
+ process.on('beforeExit', function () {
90
+ myThis.onRunComplete();
91
+ });
92
+ }
93
+ this.Config.DEBUG && console.log("END ACReporter Constructor");
94
+ }
49
95
  // This emitter function is responsible for calling this function when the info event is detected
50
- this.report = function(info) {
51
- Config.DEBUG && console.log("START 'info' emitter function");
52
-
96
+ ACReporterHTML.prototype.report = function (info) {
97
+ this.Config.DEBUG && console.log("START 'info' emitter function");
53
98
  // Save the results of a single scan to a HTML file based on the label provided
54
- savePageResults(info);
55
-
99
+ this.savePageResults(info);
56
100
  // Update the overall summary object count object to include the new scan that was performed
57
- addToSummaryCount(info.summary.counts);
58
-
101
+ this.addToSummaryCount(info.summary.counts);
59
102
  // Save the summary of this scan into global space of this reporter, to be logged
60
103
  // once the whole scan is done.
61
- addResultsToGlobal(info);
62
-
63
- Config.DEBUG && console.log("END 'info' emitter function");
104
+ this.addResultsToGlobal(info);
105
+ this.Config.DEBUG && console.log("END 'info' emitter function");
64
106
  };
65
-
107
+ ;
66
108
  /**
67
109
  * This function is responsible for performing any action when the entire karma run is done.
68
110
  * Overrides onRunComplete function from baseReporterDecorator
@@ -71,55 +113,78 @@ var ACReporterHTML = function (aChecker) {
71
113
  *
72
114
  * @memberOf this
73
115
  */
74
- this.onRunComplete = function () {
75
- Config.DEBUG && console.log("START 'ACReporterHTML:onRunComplete' function");
76
-
116
+ ACReporterHTML.prototype.onRunComplete = function () {
117
+ this.Config.DEBUG && console.log("START 'ACReporterHTML:onRunComplete' function");
77
118
  // Add End time when the whole karma run is done
78
119
  // End time will be in milliseconds elapsed since 1 January 1970 00:00:00 UTC up until now.
79
- scanSummary.endReport = Date.now();
80
-
120
+ this.scanSummary.endReport = Date.now();
81
121
  // Save summary object to a HTML file.
82
- saveSummary(scanSummary);
83
-
84
- Config.DEBUG && console.log("END 'ACReporterHTML:onRunComplete' function");
122
+ this.saveSummary(this.scanSummary);
123
+ this.Config.DEBUG && console.log("END 'ACReporterHTML:onRunComplete' function");
124
+ };
125
+ ;
126
+ /**
127
+ * This function is responsible for indexing the results into global spaces based on label.
128
+ *
129
+ * @param {Object} results - Results object which will be provided to the user/wroten to the file.
130
+ * Refer to aChecker.buildReport function's return to figure out what the object
131
+ * will look like.
132
+ *
133
+ * @return - N/A - Global object is updated with the results
134
+ *
135
+ * @memberOf this
136
+ */
137
+ ACReporterHTML.prototype.addResultsToGlobal = function (results) {
138
+ this.Config.DEBUG && console.log("START 'addResultsToGlobal' function");
139
+ // Build the single page summary object to follow the following format:
140
+ // "label": "dependencies/tools-rules-html/v2/a11y/test/g471/Table-DataNoSummaryARIA.html",
141
+ // "counts": {
142
+ // "violation": 1,
143
+ // "potentialviolation": 0,
144
+ // "recommendation": 0,
145
+ // "potentialrecommendation": 0,
146
+ // "manual": 0
147
+ // }
148
+ var pageSummaryObject = {
149
+ label: results.label,
150
+ counts: results.summary.counts
151
+ };
152
+ this.Config.DEBUG && console.log("Adding following object to scanSummary.pageScanSummary: ");
153
+ this.Config.DEBUG && console.log(pageSummaryObject);
154
+ // Add the summary count for this scan to the pageScanSummary object which is in the global space
155
+ // Index this by the label.
156
+ this.scanSummary.pageScanSummary.push(pageSummaryObject);
157
+ this.Config.DEBUG && console.log("END 'addResultsToGlobal' function");
85
158
  };
86
-
87
159
  /**
88
160
  * This function is responsible for saving a single scans results to a file as HTML. On a side note
89
161
  * this function will also extract the label which will be the file names where the results will be
90
162
  * saved.
91
163
  *
92
- * @param {Object} config - Karma config object, used to extrat the outputFolder from the ACConfig.
164
+ * @param {Object} this.Config - Karma this.Config object, used to extrat the outputFolder from the ACthis.Config.
93
165
  * @param {Object} results - Provide the scan results for a single page that should be saved.
94
166
  *
95
167
  * @memberOf this
96
168
  */
97
- var savePageResults = function (results) {
98
- Config.DEBUG && console.log("START 'savePageResults' function");
99
-
100
- // Extract the outputFolder from the ACConfig (this is the user config that they provid)
101
- var resultDir = Config.outputFolder;
102
-
103
- Config.DEBUG && console.log("Results are going to be stored under results directory: \"" + resultDir + "\"");
104
-
169
+ ACReporterHTML.prototype.savePageResults = function (results) {
170
+ this.Config.DEBUG && console.log("START 'savePageResults' function");
171
+ // Extract the outputFolder from the ACthis.Config (this is the user this.Config that they provid)
172
+ var resultDir = this.Config.outputFolder;
173
+ this.Config.DEBUG && console.log("Results are going to be stored under results directory: \"" + resultDir + "\"");
105
174
  // Build the full file name based on the label provide in the results and also the results dir specified in the
106
- // configuration.
175
+ // this.Configuration.
107
176
  var resultsFileName = pathLib.join(resultDir, results.label + '.html');
108
-
109
177
  /**************************************************** DEBUG INFORMATION ***************************************************************
110
178
  // Debug example which has label which has unix "/" in them.
111
- var resultsFileName = pathLib.join(resultDir, "dependencies/tools-rules-html/v2/a11y/test/g471/Table-layoutMultiple.html.json");
179
+ let resultsFileName = pathLib.join(resultDir, "dependencies/tools-rules-html/v2/a11y/test/g471/Table-layoutMultiple.html.json");
112
180
 
113
181
  // Debug example which has a label which has Windows "\" in them.
114
- var resultsFileName = pathLib.join(resultDir, "dependencies\\tools-rules-html\\v2\\a11y\\test\\g471\\Table-layoutMultiple.html.json");
182
+ let resultsFileName = pathLib.join(resultDir, "dependencies\\tools-rules-html\\v2\\a11y\\test\\g471\\Table-layoutMultiple.html.json");
115
183
  ***************************************************************************************************************************************/
116
-
117
184
  // Write the results object as HTML to a file.
118
- writeObjectToFileAsHTML(resultsFileName, results);
119
-
120
- Config.DEBUG && console.log("END 'savePageResults' function");
121
- }
122
-
185
+ this.writeObjectToFileAsHTML(resultsFileName, results);
186
+ this.Config.DEBUG && console.log("END 'savePageResults' function");
187
+ };
123
188
  /**
124
189
  * This function is responsible for converting a javascript object into HTML and then writing that to a
125
190
  * json file.
@@ -129,8 +194,8 @@ var ACReporterHTML = function (aChecker) {
129
194
  *
130
195
  * @memberOf this
131
196
  */
132
- var writeObjectToFileAsHTML = function (fileName, content) {
133
- const valueMap = {
197
+ ACReporterHTML.prototype.writeObjectToFileAsHTML = function (fileName, content) {
198
+ var valueMap = {
134
199
  "VIOLATION": {
135
200
  "POTENTIAL": "Needs review",
136
201
  "FAIL": "Violation",
@@ -144,152 +209,43 @@ var ACReporterHTML = function (aChecker) {
144
209
  "MANUAL": "Recommendation"
145
210
  }
146
211
  };
147
-
148
- Config.DEBUG && console.log("START 'writeObjectToFileAsHTML' function");
149
-
212
+ this.Config.DEBUG && console.log("START 'writeObjectToFileAsHTML' function");
150
213
  // Extract the parent directory of the file name that is provided
151
214
  var parentDir = pathLib.dirname(fileName);
152
-
153
- Config.DEBUG && console.log("Parent Directoy: \"" + parentDir + "\"");
154
-
215
+ this.Config.DEBUG && console.log("Parent Directoy: \"" + parentDir + "\"");
155
216
  // In the case that the parent directoy does not exist, create the directories
156
217
  if (!fs.existsSync(parentDir)) {
157
-
158
218
  // Create the parent directory recerseivly if it does not exist.
159
- fs.mkdirSync(parentDir, { recursive: true});
219
+ fs.mkdirSync(parentDir, { recursive: true });
160
220
  }
161
-
162
- Config.DEBUG && console.log("Object will be written to file: \"" + fileName + "\"");
163
-
164
- let outReport = {
221
+ this.Config.DEBUG && console.log("Object will be written to file: \"" + fileName + "\"");
222
+ var outReport = {
165
223
  report: {
166
224
  timestamp: content.summary.startScan,
167
225
  nls: content.nls,
168
226
  results: content.results,
169
227
  counts: {
170
- total: { }
228
+ total: {
229
+ All: 0
230
+ }
171
231
  }
172
232
  },
173
- rulesets: aChecker.getRulesets(),
233
+ rulesets: ACEngineManager_1.ACEngineManager.getRulesets(),
174
234
  tabURL: content.summary.URL
175
- }
176
- outReport.report.counts.total.All = 0;
177
- for (const item of content.results) {
178
- let val = valueMap[item.value[0]][item.value[1]] || item.value[0] + "_" + item.value[1];
179
- outReport.report.counts.total[val] = (outReport.report.counts.total[val] || 0) + 1;
235
+ };
236
+ for (var _i = 0, _a = content.results; _i < _a.length; _i++) {
237
+ var item = _a[_i];
238
+ var val = valueMap[item.value[0]][item.value[1]] || item.value[0] + "_" + item.value[1];
239
+ outReport.report.counts.total[val] = (outReport.report.counts.total[val] || 0) + 1;
180
240
  ++outReport.report.counts.total.All;
181
241
  }
182
-
183
242
  // Convert the Object into HTML string and write that to the file
184
243
  // Make sure to use utf-8 encoding to avoid an issues specify to OS.
185
244
  // In terms of the HTML string that is constructed use 4 spaces to format the HTML object, before
186
245
  // writing it to the file.
187
- fs.writeFileSync(fileName, genReport(outReport), { encoding: 'utf-8' });
188
-
189
- Config.DEBUG && console.log("END 'writeObjectToFileAsHTML' function");
190
- }
191
-
192
- /**
193
- * This function is responsible for initializing the summary object which will store all informations about the
194
- * scans that will occurs while karma is still running and running compliance scans.
195
- *
196
- * @return {Object} scanSummary - return the built scan summary object, which will follow the following format:
197
- * {
198
- * "scanID": "ef3aec68-f073-4f9c-b372-421ae00bd55d",
199
- * "counts": {
200
- * "violation": 0,
201
- * "potentialviolation": 0,
202
- * "recommendation": 0,
203
- * "potentialrecommendation": 0,
204
- * "manual": 0
205
- * },
206
- * "startReport": "2016-06-06T00:52:41.603Z",
207
- * "endReport": "",
208
- * "toolID": "karma-ibma-v1.0.0",
209
- * "policies": [
210
- * "CI162_5_2_DCP070116",
211
- * "CI162_5_2_DCP080115"
212
- * ],
213
- * "reportLevels": [
214
- * "violation",
215
- * "potentialviolation",
216
- * "recommendation",
217
- * "potentialrecommendation",
218
- * "manual"
219
- * ],
220
- * "labels": [
221
- * "Firefox",
222
- * "master",
223
- * "V12",
224
- * "Linux"
225
- * ],
226
- * "pageScanSummary": {}
227
- * }
228
- *
229
- * @memberOf this
230
- */
231
- var initializeSummary = function (config) {
232
- // Variable Decleration
233
- var scanSummary = {};
234
- var reportLevels = Config.reportLevels;
235
-
236
- // Initialize counts
237
- scanSummary.counts = {}
238
-
239
- // In the case that report levels are provided then populate the count object in
240
- // scanSummary.counts object with the levels which were provided in reportLevels
241
- // array.
242
- if (reportLevels) {
243
-
244
- // Iterate over the report levels and populate the pageResultsWithCount counts
245
- // object
246
- reportLevels.forEach(function (levels) {
247
- scanSummary.counts[levels] = 0;
248
- });
249
- }
250
- // Populate the scanSummary.counts object with all the levels
251
- else {
252
- scanSummary.counts = {
253
- "violation": 0,
254
- "potentialviolation": 0,
255
- "recommendation": 0,
256
- "potentialrecommendation": 0,
257
- "manual": 0,
258
- "pass": 0
259
- };
260
- }
261
-
262
- // Add ignored count disableIgnore field in config file is not true
263
- if(Config.disableIgnore == undefined || Config.disableIgnore == false || Config.disableIgnore == null){
264
- scanSummary.counts.ignored = 0;
265
- }
266
-
267
- // Add Start time when this script is loaded into browser
268
- // Start time will be in milliseconds elapsed since 1 January 1970 00:00:00 UTC up until now.
269
- scanSummary.startReport = Date.now();
270
-
271
- // Leave end report as empty for now
272
- scanSummary.endReport = '';
273
-
274
- // Add the toolID, ruleArchive, policies, reportLevels, failLevels and labels from the config to the summary
275
- scanSummary.toolID = Config.toolID;
276
- // Append the id and the name of the archive to the report.
277
- scanSummary.policies = Config.policies;
278
- scanSummary.ruleArchive = Config.ruleArchive;
279
- scanSummary.reportLevels = Config.reportLevels;
280
- scanSummary.labels = Config.label;
281
- scanSummary.failLevels = Config.failLevels;
282
-
283
- // Add scanID (UUID) to the scan summary object
284
- scanSummary.scanID = Config.scanID;
285
-
286
- // Build the paceScanSummary object which will contains all the items that were scanned and a count
287
- // summary for each of the scanned items.
288
- scanSummary.pageScanSummary = [];
289
-
290
- return scanSummary;
291
- }
292
-
246
+ fs.writeFileSync(fileName, genReport_1.genReport(outReport), { encoding: 'utf-8' });
247
+ this.Config.DEBUG && console.log("END 'writeObjectToFileAsHTML' function");
248
+ };
293
249
  /**
294
250
  * This function is responsible for saving the summary object of the while scan to a summary file.
295
251
  *
@@ -297,10 +253,8 @@ var ACReporterHTML = function (aChecker) {
297
253
  *
298
254
  * @memberOf this
299
255
  */
300
- var saveSummary = function (summary) {
301
-
302
- }
303
-
256
+ ACReporterHTML.prototype.saveSummary = function (summary) {
257
+ };
304
258
  /**
305
259
  * This function is responsible for checking if a number needs a leading 0, and if it is needed
306
260
  * add the leading 0 and return that as the new number.
@@ -311,112 +265,15 @@ var ACReporterHTML = function (aChecker) {
311
265
  *
312
266
  * @memberOf this
313
267
  */
314
- var datePadding = function(number) {
315
- Config.DEBUG && console.log("START 'datePadding' function");
316
-
268
+ ACReporterHTML.prototype.datePadding = function (number) {
269
+ this.Config.DEBUG && console.log("START 'datePadding' function");
317
270
  // In the case that the number is less then 10 we need to add the leading '0' to the number.
318
271
  number = number < 10 ? '0' + number : number;
319
-
320
- Config.DEBUG && console.log("END 'datePadding' function");
321
-
272
+ this.Config.DEBUG && console.log("END 'datePadding' function");
322
273
  return number;
323
- }
324
-
325
- /**
326
- * This function is responsible for indexing the results into global spaces based on label.
327
- *
328
- * @param {Object} results - Results object which will be provided to the user/wroten to the file.
329
- * Refer to aChecker.buildReport function's return to figure out what the object
330
- * will look like.
331
- *
332
- * @return - N/A - Global object is updated with the results
333
- *
334
- * @memberOf this
335
- */
336
- var addResultsToGlobal = function (results) {
337
- Config.DEBUG && console.log("START 'addResultsToGlobal' function");
338
-
339
- // Build the single page summary object to follow the following format:
340
- // "label": "dependencies/tools-rules-html/v2/a11y/test/g471/Table-DataNoSummaryARIA.html",
341
- // "counts": {
342
- // "violation": 1,
343
- // "potentialviolation": 0,
344
- // "recommendation": 0,
345
- // "potentialrecommendation": 0,
346
- // "manual": 0
347
- // }
348
- var pageSummaryObject = {
349
- label: results.label,
350
- counts: results.summary.counts
351
- }
352
-
353
- Config.DEBUG && console.log("Adding following object to scanSummary.pageScanSummary: ");
354
- Config.DEBUG && console.log(pageSummaryObject);
355
-
356
- // Add the summary count for this scan to the pageScanSummary object which is in the global space
357
- // Index this by the label.
358
- scanSummary.pageScanSummary.push(pageSummaryObject);
359
-
360
- Config.DEBUG && console.log("END 'addResultsToGlobal' function");
361
- }
362
-
363
- /**
364
- * This function is responsible for updating/creating the global violation summary for the engine karma run
365
- * for browser that it is running on. Will take the pageCount object which is part of the page object and
366
- * add extract the values for each of the levels and add them to the global object. This will provide an overall
367
- * summary of violations for all testcases run and all scans done.
368
- *
369
- * @param {Object} pageCount - Provide the page count object, in the following format:
370
- *
371
- * @return N/A - Global summary object is updated with the counts
372
- *
373
- * @memberOf this
374
- */
375
- var addToSummaryCount = function (pageCount) {
376
-
377
- // Variable Decleration
378
- var ACScanSummary = scanSummary.counts || {};
379
- var addedToSummary = false;
380
-
381
- // In the case ACScanSummary is empty, simply assign pageCount to ACScanSummary
382
- if (Object.keys(ACScanSummary).length === 0) {
383
-
384
- // Set pageCount as the summary count
385
- ACScanSummary = pageCount;
386
-
387
- addedToSummary = true;
388
- }
389
-
390
- // In the case that this is not first scan, handle adding up the summary
391
- if (!addedToSummary) {
392
- // Go through the pageCount object and for each of the levels, extract the value
393
- // and add it to the aChecker violation summary object.
394
- // This will keep track of an overall summary of the violations for all testscases, that
395
- // were run for a single karma run.
396
- for (var level in pageCount) {
397
- ACScanSummary[level] += pageCount[level];
398
- }
399
- }
400
-
401
- // Assign the new violation summary back to the global object
402
- scanSummary.counts = ACScanSummary;
403
- }
404
-
405
- scanSummary = initializeSummary();
406
-
407
- var myThis = this;
408
- if (typeof(after) !== "undefined") {
409
- after(function(done) {
410
- myThis.onRunComplete();
411
- done && done();
412
- });
413
- } else {
414
- process.on('beforeExit', function() {
415
- myThis.onRunComplete();
416
- });
417
- }
418
- Config.DEBUG && console.log("END ACReporter Constructor");
419
- };
420
-
421
- // Export this function, which will be called when accessibility-checker loads
422
- module.exports = ACReporterHTML;
274
+ };
275
+ return ACReporterHTML;
276
+ }());
277
+ exports.ACReporterHTML = ACReporterHTML;
278
+ ;
279
+ //# sourceMappingURL=ACReporterHTML.js.map