testaro 30.0.8 → 32.0.1

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 (212) hide show
  1. package/CONTRIBUTING.md +26 -4
  2. package/LICENSE +1 -1
  3. package/README.md +24 -2
  4. package/aceconfig.js +27 -0
  5. package/actSpecs.js +28 -1
  6. package/call.js +22 -1
  7. package/data/template.js +22 -0
  8. package/dirWatch.js +22 -0
  9. package/package.json +1 -1
  10. package/procs/aslint.js +24 -0
  11. package/procs/getLocatorData.js +29 -1
  12. package/procs/getSource.js +30 -3
  13. package/procs/isInlineLink.js +23 -0
  14. package/procs/operable.js +23 -2
  15. package/procs/sample.js +22 -0
  16. package/procs/standardize.js +28 -7
  17. package/procs/tellServer.js +24 -2
  18. package/procs/testaro.js +26 -1
  19. package/procs/visChange.js +22 -0
  20. package/run.js +373 -83
  21. package/testaro/allCaps.js +22 -0
  22. package/testaro/allHidden.js +22 -0
  23. package/testaro/allSlanted.js +22 -0
  24. package/testaro/attVal.js +22 -0
  25. package/testaro/autocomplete.js +22 -0
  26. package/testaro/bulk.js +22 -0
  27. package/testaro/buttonMenu.js +22 -0
  28. package/testaro/distortion.js +22 -0
  29. package/testaro/docType.js +22 -0
  30. package/testaro/dupAtt.js +22 -0
  31. package/testaro/elements.js +22 -0
  32. package/testaro/embAc.js +22 -0
  33. package/testaro/filter.js +22 -0
  34. package/testaro/focAll.js +22 -0
  35. package/testaro/focInd.js +22 -0
  36. package/testaro/focOp.js +22 -0
  37. package/testaro/focVis.js +22 -0
  38. package/testaro/headEl.js +22 -0
  39. package/testaro/headingAmb.js +22 -0
  40. package/testaro/hovInd.js +21 -24
  41. package/testaro/hover.js +22 -0
  42. package/testaro/labClash.js +22 -0
  43. package/testaro/lineHeight.js +22 -0
  44. package/testaro/linkAmb.js +22 -0
  45. package/testaro/linkTitle.js +22 -0
  46. package/testaro/linkUl.js +22 -0
  47. package/testaro/miniText.js +22 -0
  48. package/testaro/motion.js +22 -0
  49. package/testaro/nonTable.js +22 -0
  50. package/testaro/opFoc.js +22 -0
  51. package/testaro/pseudoP.js +25 -3
  52. package/testaro/radioSet.js +22 -0
  53. package/testaro/role.js +22 -0
  54. package/testaro/styleDiff.js +80 -1
  55. package/testaro/tabNav.js +99 -2
  56. package/testaro/targetSize.js +22 -0
  57. package/testaro/textNodes.js +25 -3
  58. package/testaro/title.js +22 -0
  59. package/testaro/zIndex.js +22 -0
  60. package/tests/alfa.js +34 -12
  61. package/tests/aslint.js +55 -17
  62. package/tests/axe.js +35 -9
  63. package/tests/htmlcs.js +109 -78
  64. package/tests/ibm.js +111 -45
  65. package/tests/nuVal.js +39 -9
  66. package/tests/qualWeb.js +49 -25
  67. package/tests/testaro.js +50 -22
  68. package/tests/wave.js +36 -10
  69. package/validation/executors/run.js +26 -2
  70. package/validation/executors/test.js +27 -3
  71. package/validation/executors/tests.js +26 -2
  72. package/validation/executors/watchDir.js +26 -2
  73. package/validation/executors/watchNet.js +26 -2
  74. package/validation/jobs/todo/README.md +22 -0
  75. package/validation/tests/targets/adbID/index.html +21 -0
  76. package/validation/tests/targets/allCaps/index.html +21 -0
  77. package/validation/tests/targets/allHidden/ariaHiddenBody.html +21 -0
  78. package/validation/tests/targets/allHidden/good.html +21 -0
  79. package/validation/tests/targets/allHidden/hiddenMain.html +21 -0
  80. package/validation/tests/targets/allHidden/mixedHidden.html +22 -1
  81. package/validation/tests/targets/allHidden/noBody.html +21 -0
  82. package/validation/tests/targets/allHidden/noMain.html +21 -0
  83. package/validation/tests/targets/allHidden/noneDoc.html +21 -0
  84. package/validation/tests/targets/allHidden/visHiddenMain.html +21 -0
  85. package/validation/tests/targets/allSlanted/index.html +21 -0
  86. package/validation/tests/targets/altScheme/index.html +21 -0
  87. package/validation/tests/targets/attVal/bad.html +21 -0
  88. package/validation/tests/targets/attVal/good.html +21 -0
  89. package/validation/tests/targets/autocomplete/bad.html +21 -0
  90. package/validation/tests/targets/autocomplete/good.html +21 -0
  91. package/validation/tests/targets/bulk/bad.html +21 -0
  92. package/validation/tests/targets/bulk/good.html +21 -0
  93. package/validation/tests/targets/buttonMenu/bad.html +21 -0
  94. package/validation/tests/targets/buttonMenu/bad.js +27 -0
  95. package/validation/tests/targets/buttonMenu/good.html +21 -0
  96. package/validation/tests/targets/buttonMenu/good.js +27 -0
  97. package/validation/tests/targets/buttonMenu/style.css +27 -0
  98. package/validation/tests/targets/captionLoc/index.html +21 -0
  99. package/validation/tests/targets/datalistRef/index.html +21 -0
  100. package/validation/tests/targets/distortion/index.html +21 -0
  101. package/validation/tests/targets/docType/bad.html +21 -0
  102. package/validation/tests/targets/docType/good.html +21 -0
  103. package/validation/tests/targets/dupAtt/bad.html +21 -0
  104. package/validation/tests/targets/dupAtt/good.html +21 -0
  105. package/validation/tests/targets/elements/index.html +21 -0
  106. package/validation/tests/targets/embAc/bad.html +21 -0
  107. package/validation/tests/targets/embAc/good.html +21 -0
  108. package/validation/tests/targets/filter/bad.html +21 -0
  109. package/validation/tests/targets/filter/good.html +21 -0
  110. package/validation/tests/targets/focAll/good.html +21 -0
  111. package/validation/tests/targets/focAll/less.html +21 -0
  112. package/validation/tests/targets/focAll/more.html +21 -0
  113. package/validation/tests/targets/focInd/bad.html +21 -0
  114. package/validation/tests/targets/focInd/good.html +21 -0
  115. package/validation/tests/targets/focOp/bad.html +21 -0
  116. package/validation/tests/targets/focOp/good.html +21 -0
  117. package/validation/tests/targets/focVis/index.html +21 -0
  118. package/validation/tests/targets/headEl/index.html +21 -0
  119. package/validation/tests/targets/headingAmb/index.html +21 -0
  120. package/validation/tests/targets/hovInd/index.html +21 -0
  121. package/validation/tests/targets/hover/bad.html +21 -0
  122. package/validation/tests/targets/hover/good.html +21 -0
  123. package/validation/tests/targets/hr/index.html +21 -0
  124. package/validation/tests/targets/imageLink/index.html +21 -0
  125. package/validation/tests/targets/labClash/bad.html +21 -0
  126. package/validation/tests/targets/labClash/good.html +21 -0
  127. package/validation/tests/targets/legendLoc/index.html +21 -0
  128. package/validation/tests/targets/lineHeight/index.html +21 -0
  129. package/validation/tests/targets/linkAmb/index.html +21 -0
  130. package/validation/tests/targets/linkExt/index.html +21 -0
  131. package/validation/tests/targets/linkOldAtt/index.html +21 -0
  132. package/validation/tests/targets/linkTitle/index.html +21 -0
  133. package/validation/tests/targets/linkTo/index.html +21 -0
  134. package/validation/tests/targets/linkUl/bad.html +21 -0
  135. package/validation/tests/targets/linkUl/good.html +21 -0
  136. package/validation/tests/targets/linkUl/na.html +21 -0
  137. package/validation/tests/targets/miniText/index.html +21 -0
  138. package/validation/tests/targets/motion/bad.css +27 -0
  139. package/validation/tests/targets/motion/bad.html +21 -0
  140. package/validation/tests/targets/motion/good.html +21 -0
  141. package/validation/tests/targets/nonTable/index.html +21 -0
  142. package/validation/tests/targets/opFoc/bad.html +21 -0
  143. package/validation/tests/targets/opFoc/good.html +21 -0
  144. package/validation/tests/targets/optRoleSel/index.html +21 -0
  145. package/validation/tests/targets/phOnly/index.html +21 -0
  146. package/validation/tests/targets/pseudoP/index.html +21 -0
  147. package/validation/tests/targets/radioSet/bad.html +21 -0
  148. package/validation/tests/targets/radioSet/good.html +21 -0
  149. package/validation/tests/targets/role/bad.html +21 -0
  150. package/validation/tests/targets/role/good.html +21 -0
  151. package/validation/tests/targets/secHeading/index.html +21 -0
  152. package/validation/tests/targets/styleDiff/bad.html +21 -0
  153. package/validation/tests/targets/styleDiff/good.html +21 -0
  154. package/validation/tests/targets/tabNav/bad.html +21 -0
  155. package/validation/tests/targets/tabNav/bad.js +27 -0
  156. package/validation/tests/targets/tabNav/good.html +21 -0
  157. package/validation/tests/targets/tabNav/good.js +27 -0
  158. package/validation/tests/targets/tabNav/style.css +27 -0
  159. package/validation/tests/targets/targetSize/index.html +21 -0
  160. package/validation/tests/targets/textNodes/index.html +21 -0
  161. package/validation/tests/targets/textSem/index.html +21 -0
  162. package/validation/tests/targets/title/bad.html +21 -0
  163. package/validation/tests/targets/title/good.html +21 -0
  164. package/validation/tests/targets/titledEl/index.html +21 -0
  165. package/validation/tests/targets/zIndex/bad.html +21 -0
  166. package/validation/tests/targets/zIndex/good.html +21 -0
  167. package/validation/validateTest.js +39 -3
  168. package/validation/watch/done/README.md +23 -1
  169. package/validation/watch/todo/README.md +23 -1
  170. package/watch.js +32 -7
  171. package/call-old.js +0 -86
  172. package/procs/allText.js +0 -76
  173. package/procs/allVis.js +0 -17
  174. package/procs/getTextNodes.js +0 -39
  175. package/procs/linksByType.js +0 -54
  176. package/procs/nav.js +0 -259
  177. package/procs/textOf.txt +0 -73
  178. package/test copy.js +0 -38
  179. package/validation/tests/old/allCaps.json +0 -102
  180. package/validation/tests/old/allHidden.json +0 -314
  181. package/validation/tests/old/attVal.json +0 -60
  182. package/validation/tests/old/autocomplete.json +0 -51
  183. package/validation/tests/old/bulk.json +0 -48
  184. package/validation/tests/old/docType.json +0 -46
  185. package/validation/tests/old/dupAtt.json +0 -51
  186. package/validation/tests/old/elements.json +0 -140
  187. package/validation/tests/old/embAc.json +0 -54
  188. package/validation/tests/old/filter.json +0 -55
  189. package/validation/tests/old/focAll.json +0 -68
  190. package/validation/tests/old/focInd.json +0 -69
  191. package/validation/tests/old/focOp.json +0 -62
  192. package/validation/tests/old/focVis.json +0 -35
  193. package/validation/tests/old/hover.json +0 -118
  194. package/validation/tests/old/labClash.json +0 -52
  195. package/validation/tests/old/linkTo.json +0 -35
  196. package/validation/tests/old/linkUl.json +0 -71
  197. package/validation/tests/old/menuNav.json +0 -106
  198. package/validation/tests/old/miniText.json +0 -36
  199. package/validation/tests/old/motion.json +0 -62
  200. package/validation/tests/old/nonTable.json +0 -37
  201. package/validation/tests/old/radioSet.json +0 -52
  202. package/validation/tests/old/role.json +0 -60
  203. package/validation/tests/old/styleDiff.json +0 -71
  204. package/validation/tests/old/tabNav.json +0 -106
  205. package/validation/tests/old/temp.js +0 -28
  206. package/validation/tests/old/textNodes.json +0 -98
  207. package/validation/tests/old/title.json +0 -46
  208. package/validation/tests/old/titledEl.json +0 -37
  209. package/validation/tests/old/zIndex.json +0 -49
  210. package/validation/tests/targets/tabNav/goodMoz.js +0 -206
  211. package/watch-old.js +0 -275
  212. package/watch-temp.js +0 -45
package/tests/nuVal.js CHANGED
@@ -1,3 +1,25 @@
1
+ /*
2
+ © 2022–2023 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
1
23
  /*
2
24
  nuVal
3
25
  This test subjects a page and its source to the Nu Html Checker, thereby testing scripted
@@ -53,6 +75,7 @@ exports.reporter = async (page, options) => {
53
75
  };
54
76
  const nuURL = 'https://validator.w3.org/nu/?parser=html&out=json';
55
77
  const data = {};
78
+ const result = {};
56
79
  // For each page type:
57
80
  for (const page of [['pageContent', pageContent], ['rawPage', rawPage]]) {
58
81
  try {
@@ -62,11 +85,11 @@ exports.reporter = async (page, options) => {
62
85
  const nuData = await nuResult.json();
63
86
  // Delete left and right quotation marks and their erratic invalid replacements.
64
87
  const nuDataClean = JSON.parse(JSON.stringify(nuData).replace(/[\u{fffd}“”]/ug, ''));
65
- data[page[0]] = nuDataClean;
88
+ result[page[0]] = nuDataClean;
66
89
  // If there is a report and rules were specified:
67
- if (! data[page[0]].error && rules && Array.isArray(rules) && rules.length) {
90
+ if (! result[page[0]].error && rules && Array.isArray(rules) && rules.length) {
68
91
  // Remove all messages except those specified.
69
- data[page[0]].messages = data[page[0]].messages.filter(message => rules.some(rule => {
92
+ result[page[0]].messages = result[page[0]].messages.filter(message => rules.some(rule => {
70
93
  if (rule[0] === '=') {
71
94
  return message.message === rule.slice(1);
72
95
  }
@@ -79,14 +102,21 @@ exports.reporter = async (page, options) => {
79
102
  }
80
103
  }));
81
104
  }
105
+ return {
106
+ data,
107
+ result
108
+ };
82
109
  }
83
110
  catch (error) {
84
- console.log(`ERROR: nuVal report validation failed (${error.message})`);
85
- return {result: {
86
- prevented: true,
87
- error: 'nuVal report validation failed',
88
- }};
111
+ const message = `ERROR: Act failed (${error.message})`;
112
+ console.log(message);
113
+ return {
114
+ data: {
115
+ prevented: true,
116
+ error: message,
117
+ },
118
+ result: {}
119
+ };
89
120
  }
90
121
  }
91
- return {result: data};
92
122
  };
package/tests/qualWeb.js CHANGED
@@ -1,3 +1,25 @@
1
+ /*
2
+ © 2023 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
1
23
  /*
2
24
  qualWeb
3
25
  This test implements the QualWeb ruleset for accessibility.
@@ -19,6 +41,7 @@ const clusterOptions = {
19
41
  // Conducts and reports a QualWeb test.
20
42
  exports.reporter = async (page, options) => {
21
43
  const {withNewContent, rules} = options;
44
+ const data = {};
22
45
  // Start the QualWeb core engine.
23
46
  await qualWeb.start(clusterOptions);
24
47
  // Specify the invariant test options.
@@ -100,13 +123,13 @@ exports.reporter = async (page, options) => {
100
123
  qualWebOptions.execute.bp = false;
101
124
  }
102
125
  // Get the report.
103
- let reports = await qualWeb.evaluate(qualWebOptions);
126
+ let actReports = await qualWeb.evaluate(qualWebOptions);
104
127
  // Remove the copy of the DOM from it.
105
- let report = reports[withNewContent ? qualWebOptions.url : 'customHtml'];
106
- if (report && report.system && report.system.page && report.system.page.dom) {
107
- delete report.system.page.dom;
108
- // For each test section of the report:
109
- const {modules} = report;
128
+ const result = actReports[withNewContent ? qualWebOptions.url : 'customHtml'];
129
+ if (result && result.system && result.system.page && result.system.page.dom) {
130
+ delete result.system.page.dom;
131
+ // For each test section of the act report:
132
+ const {modules} = result;
110
133
  if (modules) {
111
134
  for (const section of ['act-rules', 'wcag-techniques', 'best-practices']) {
112
135
  if (qualWebOptions[section]) {
@@ -125,15 +148,15 @@ exports.reporter = async (page, options) => {
125
148
  else {
126
149
  if (ruleAssertions.results) {
127
150
  ruleAssertions.results = ruleAssertions.results.filter(
128
- result => result.verdict !== 'passed'
151
+ raResult => raResult.verdict !== 'passed'
129
152
  );
130
153
  }
131
154
  }
132
155
  }
133
156
  // Shorten long HTML codes of elements.
134
157
  const {results} = ruleAssertions;
135
- results.forEach(result => {
136
- const {elements} = result;
158
+ results.forEach(raResult => {
159
+ const {elements} = raResult;
137
160
  if (elements && elements.length) {
138
161
  elements.forEach(element => {
139
162
  if (element.htmlCode && element.htmlCode.length > 700) {
@@ -145,38 +168,39 @@ exports.reporter = async (page, options) => {
145
168
  });
146
169
  }
147
170
  else {
148
- report.prevented = true;
149
- report.error = 'ERROR: No assertions';
171
+ data.prevented = true;
172
+ data.error = 'ERROR: No assertions';
150
173
  }
151
174
  }
152
175
  else {
153
- report.prevented = true;
154
- report.error = `ERROR: No ${section} section`;
176
+ data.prevented = true;
177
+ data.error = `ERROR: No ${section} section`;
155
178
  }
156
179
  }
157
180
  }
158
181
  }
159
182
  else {
160
- report.prevented = true;
161
- report.error = 'ERROR: No modules';
183
+ data.prevented = true;
184
+ data.error = 'ERROR: No modules';
162
185
  }
163
186
  }
164
187
  else {
165
- report.prevented = true;
166
- report.error = 'ERROR: No DOM';
188
+ data.prevented = true;
189
+ data.error = 'ERROR: No DOM';
167
190
  }
168
191
  // Stop the QualWeb core engine.
169
192
  await qualWeb.stop();
170
193
  // Return the result.
171
194
  try {
172
- JSON.stringify(report);
195
+ JSON.stringify(result);
173
196
  }
174
197
  catch(error) {
175
- console.log(`ERROR: qualWeb result cannot be made JSON (${error.message})`);
176
- report = {
177
- prevented: true,
178
- error: `ERROR: qualWeb result cannot be made JSON (${error.message})`
179
- };
180
- }
181
- return {result: report};
198
+ const message = `ERROR: qualWeb result cannot be made JSON (${error.message})`;
199
+ data.prevented = true;
200
+ data.error = message;
201
+ };
202
+ return {
203
+ data,
204
+ result
205
+ };
182
206
  };
package/tests/testaro.js CHANGED
@@ -1,3 +1,25 @@
1
+ /*
2
+ © 2023 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
1
23
  /*
2
24
  testaro
3
25
  This test implements the Testaro evaluative rules.
@@ -9,7 +31,7 @@
9
31
  const {init, report} = require('../procs/testaro');
10
32
  // Module to handle files.
11
33
  const fs = require('fs/promises');
12
- // Module to send a notice to the server.
34
+ // Module to send a notice to an observer.
13
35
  const {tellServer} = require('../procs/tellServer');
14
36
 
15
37
  // ######## CONSTANTS
@@ -109,18 +131,19 @@ const wait = ms => {
109
131
  };
110
132
  // Conducts and reports Testaro tests.
111
133
  exports.reporter = async (page, options) => {
112
- const {withItems, stopOnFail, granular, args} = options;
134
+ const {report, withItems, stopOnFail, args} = options;
113
135
  const argRules = args ? Object.keys(args) : null;
114
136
  const rules = options.rules || ['y', ... Object.keys(evalRules)];
115
- // Initialize the data.
137
+ // Initialize the act report.
116
138
  const data = {
117
- rules: {},
118
- important: {
119
- preventions: [],
120
- invalid: [],
121
- testTimes: {}
122
- }
139
+ prevented: false,
140
+ error: '',
141
+ rulePreventions: [],
142
+ rulePreventionMessages: {},
143
+ rulesInvalid: [],
144
+ ruleTestTimes: {}
123
145
  };
146
+ const result = {};
124
147
  // If the rule specification is valid:
125
148
  if (
126
149
  rules.length > 1
@@ -149,7 +172,7 @@ exports.reporter = async (page, options) => {
149
172
  }
150
173
  // If granular reporting is specified:
151
174
  const what = evalRules[rule] || etcRules[rule];
152
- if (granular) {
175
+ if (report.observe) {
153
176
  // Report the rule to the server.
154
177
  tellServer(
155
178
  options.report,
@@ -158,10 +181,10 @@ exports.reporter = async (page, options) => {
158
181
  );
159
182
  }
160
183
  // Test the page.
161
- if (! data.rules[rule]) {
162
- data.rules[rule] = {};
184
+ if (! result[rule]) {
185
+ result[rule] = {};
163
186
  }
164
- data.rules[rule].what = what;
187
+ result[rule].what = what;
165
188
  try {
166
189
  const startTime = Date.now();
167
190
  const ruleReport = isJS
@@ -171,11 +194,11 @@ exports.reporter = async (page, options) => {
171
194
  const endTime = Date.now();
172
195
  testTimes.push([rule, Math.round((endTime - startTime) / 1000)]);
173
196
  Object.keys(ruleReport).forEach(key => {
174
- data.rules[rule][key] = ruleReport[key];
197
+ result[rule][key] = ruleReport[key];
175
198
  });
176
- data.rules[rule].totals = data.rules[rule].totals.map(total => Math.round(total));
199
+ result[rule].totals = result[rule].totals.map(total => Math.round(total));
177
200
  if (ruleReport.prevented) {
178
- data.important.preventions.push(rule);
201
+ data.rulePreventions.push(rule);
179
202
  }
180
203
  // If testing is to stop after a failure and the page failed the test:
181
204
  if (stopOnFail && ruleReport.totals.some(total => total)) {
@@ -186,26 +209,31 @@ exports.reporter = async (page, options) => {
186
209
  // If an error is thrown by the test:
187
210
  catch(error) {
188
211
  // Report this.
189
- data.important.preventions.push(rule);
212
+ data.rulePreventions.push(rule);
213
+ data.rulePreventionMessages[rule] = error.message;
190
214
  console.log(`ERROR: Test of testaro rule ${rule} prevented (${error.message})`);
191
215
  }
192
216
  }
193
217
  // Otherwise, i.e. if the rule is undefined or doubly defined:
194
218
  else {
195
219
  // Report this.
196
- data.important.invalid.push(rule);
220
+ data.invalid.push(rule);
197
221
  console.log(`ERROR: Rule ${rule} not validly defined`);
198
222
  }
199
223
  }
200
224
  testTimes.sort((a, b) => b[1] - a[1]).forEach(pair => {
201
- data.important.testTimes[pair[0]] = pair[1];
225
+ data.ruleTestTimes[pair[0]] = pair[1];
202
226
  });
203
227
  }
204
228
  // Otherwise, i.e. if the rule specification is invalid:
205
229
  else {
206
- console.log('ERROR: Testaro rule specification invalid');
230
+ const message = 'ERROR: Testaro rule specification invalid';
231
+ console.log(message);
207
232
  data.prevented = true;
208
- data.error = 'ERROR: Rule specification invalid';
233
+ data.error = message;
209
234
  }
210
- return {result: data};
235
+ return {
236
+ data,
237
+ result
238
+ };
211
239
  };
package/tests/wave.js CHANGED
@@ -1,3 +1,25 @@
1
+ /*
2
+ © 2021–2023 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
1
23
  /*
2
24
  wave
3
25
  This test implements the WebAIM WAVE ruleset for accessibility. The 'reportType' argument
@@ -10,7 +32,8 @@ exports.reporter = async (page, options) => {
10
32
  const {reportType, rules} = options;
11
33
  const waveKey = process.env.WAVE_KEY;
12
34
  // Get the data from a WAVE test.
13
- const data = await new Promise(resolve => {
35
+ const data = {};
36
+ const result = await new Promise(resolve => {
14
37
  https.get(
15
38
  {
16
39
  host: 'wave.webaim.org',
@@ -18,16 +41,16 @@ exports.reporter = async (page, options) => {
18
41
  protocol: 'https:'
19
42
  },
20
43
  response => {
21
- let report = '';
44
+ let actReport = '';
22
45
  response.on('data', chunk => {
23
- report += chunk;
46
+ actReport += chunk;
24
47
  });
25
48
  // When the data arrive:
26
49
  response.on('end', async () => {
27
50
  try {
28
51
  // Delete unnecessary properties.
29
- const result = JSON.parse(report);
30
- const {categories} = result;
52
+ const actResult = JSON.parse(actReport);
53
+ const {categories} = actResult;
31
54
  delete categories.feature;
32
55
  delete categories.structure;
33
56
  delete categories.aria;
@@ -60,18 +83,21 @@ exports.reporter = async (page, options) => {
60
83
  items[issueName].wcag = guidelines;
61
84
  });
62
85
  });
63
- return resolve(result);
86
+ return resolve(actResult);
64
87
  }
65
88
  catch (error) {
89
+ data.prevented = true;
90
+ data.error = error.message;
66
91
  return resolve({
67
- prevented: true,
68
- error: error.message,
69
- report
92
+ actReport
70
93
  });
71
94
  }
72
95
  });
73
96
  }
74
97
  );
75
98
  });
76
- return {result: data};
99
+ return {
100
+ data,
101
+ result
102
+ };
77
103
  };
@@ -1,5 +1,29 @@
1
- // run.js
2
- // Validator for immediate job execution.
1
+ /*
2
+ © 2022–2023 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
23
+ /*
24
+ run.js
25
+ Validator for immediate job execution.
26
+ */
3
27
 
4
28
  // ########## IMPORTS
5
29
 
@@ -1,6 +1,30 @@
1
- // test.js
2
- // Validator for one Testaro test.
3
- // Execution example: npm test focOp
1
+ /*
2
+ © 2022–2023 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
23
+ /*
24
+ test.js
25
+ Validator for one Testaro test.
26
+ Execution example: npm test focOp
27
+ */
4
28
 
5
29
  const testID = process.argv[2];
6
30
  const {validateTest} = require('../validateTest');
@@ -1,5 +1,29 @@
1
- // tests.js
2
- // Validator for Testaro tests.
1
+ /*
2
+ © 2022–2023 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
23
+ /*
24
+ tests.js
25
+ Validator for Testaro tests.
26
+ */
3
27
 
4
28
  // IMPORTS
5
29
 
@@ -1,5 +1,29 @@
1
- // watchDir.js
2
- // Validator for directory watching.
1
+ /*
2
+ © 2022–2023 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
23
+ /*
24
+ watchDir.js
25
+ Validator for directory watching.
26
+ */
3
27
 
4
28
  // IMPORTS
5
29
 
@@ -1,5 +1,29 @@
1
- // watchNet.js
2
- // Validator for network watching.
1
+ /*
2
+ © 2022–2023 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ */
22
+
23
+ /*
24
+ watchNet.js
25
+ Validator for network watching.
26
+ */
3
27
 
4
28
  // IMPORTS
5
29
 
@@ -1,3 +1,25 @@
1
1
  # jobs
2
2
 
3
3
  Directory containing jobs for validation.
4
+
5
+ # License
6
+
7
+ © 2022–2023 CVS Health and/or one of its affiliates. All rights reserved.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
@@ -1,4 +1,25 @@
1
1
  <!DOCTYPE html>
2
+ <!--
3
+ © 2023 CVS Health and/or one of its affiliates. All rights reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+ -->
2
23
  <html lang="en-US">
3
24
  <head>
4
25
  <meta charset="utf-8">
@@ -1,4 +1,25 @@
1
1
  <!DOCTYPE html>
2
+ <!--
3
+ © 2023 CVS Health and/or one of its affiliates. All rights reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+ -->
2
23
  <html lang="en-US">
3
24
  <head>
4
25
  <meta charset="utf-8">