testaro 32.0.7 → 32.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "32.0.7",
3
+ "version": "32.0.9",
4
4
  "description": "Run 960 web accessibility tests from 9 tools and get a standardized report",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -36,7 +36,6 @@
36
36
  "aslint-testaro": "*",
37
37
  "axe-playwright": "*",
38
38
  "dotenv": "*",
39
- "node-fetch": "<3.0.0",
40
39
  "pixelmatch": "*",
41
40
  "playwright": "*"
42
41
  },
@@ -27,8 +27,6 @@
27
27
 
28
28
  // IMPORTS
29
29
 
30
- // Module to make HTTP requests.
31
- const fetch = require('node-fetch');
32
30
  // Module to process files.
33
31
  const fs = require('fs/promises');
34
32
 
@@ -226,7 +226,7 @@ const doNuVal = (result, standardResult, docType) => {
226
226
  const tagNameLCArray = item.message.match(
227
227
  /^Element ([^ ]+)|^An (img) element| (meta|script) element| element (script)| tag (script)/
228
228
  );
229
- if (tagNameLCArray && tagNameLCArray.length > 1) {
229
+ if (tagNameLCArray && tagNameLCArray[1]) {
230
230
  identifiers[0] = tagNameLCArray[1].toUpperCase();
231
231
  }
232
232
  }
package/tests/ibm.js CHANGED
@@ -175,12 +175,14 @@ exports.reporter = async (page, options) => {
175
175
  const {withItems, withNewContent, rules} = options;
176
176
  const contentType = withNewContent ? 'new' : 'existing';
177
177
  console.log(`>>>>>> Content type: ${contentType}`);
178
- const timeLimit = 30;
178
+ const timeLimit = 25;
179
179
  const typeContent = contentType === 'existing' ? await page.content() : await page.url();
180
180
  try {
181
181
  const actReport = await doTest(typeContent, withItems, timeLimit, rules);
182
182
  const {data, result} = actReport;
183
+ // If the act was prevented:
183
184
  if (data && data.prevented) {
185
+ // Report this.
184
186
  const message = `ERROR: Act failed or timed out at ${timeLimit} seconds`;
185
187
  console.log(message);
186
188
  data.error = data.error ? `${data.error}; ${message}` : message;
@@ -189,7 +191,9 @@ exports.reporter = async (page, options) => {
189
191
  result: {}
190
192
  };
191
193
  }
194
+ // Otherwise, i.e. if the act was not prevented:
192
195
  else {
196
+ // Return the result.
193
197
  return {
194
198
  data,
195
199
  result
package/tests/nuVal.js CHANGED
@@ -33,8 +33,6 @@
33
33
 
34
34
  // ########## IMPORTS
35
35
 
36
- // Module to make HTTP requests.
37
- const fetch = require('node-fetch');
38
36
  // Module to process files.
39
37
  const fs = require('fs/promises');
40
38
 
@@ -48,14 +46,16 @@ exports.reporter = async (page, options) => {
48
46
  const url = page.url();
49
47
  const scheme = url.replace(/:.+/, '');
50
48
  let rawPage;
49
+ // If it is local.
51
50
  if (scheme === 'file') {
52
51
  const filePath = url.slice(7);
53
52
  rawPage = await fs.readFile(filePath, 'utf8');
54
53
  }
55
54
  else {
55
+ // If it is remote (15 seconds allowed).
56
56
  try {
57
- const rawPageResponse = await fetch(url);
58
- rawPage = await rawPageResponse.text();
57
+ const rawPageResponse = await fetch(url, {signal: AbortSignal.timeout(15000)});
58
+ rawPage = rawPageResponse.body;
59
59
  }
60
60
  catch(error) {
61
61
  console.log(`ERROR getting page for nuVal test (${error.message})`);
package/watch.js CHANGED
@@ -335,7 +335,9 @@ const checkNetJob = async (servers, serverIndex, isForever, interval, noJobCount
335
335
  // Otherwise, i.e. if it was any other error:
336
336
  else {
337
337
  // Report this.
338
- console.log(`ERROR: ${logStart}no response, but got error message ${error.message}`);
338
+ console.log(
339
+ `ERROR: ${logStart}no response, but got error message ${error.message.slice(0, 200)}`
340
+ );
339
341
  // Check the next server.
340
342
  await checkNetJob(servers, serverIndex + 1, isForever, interval, noJobCount + 1);
341
343
  }