testaro 69.0.1 → 69.0.2

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 (2) hide show
  1. package/package.json +1 -1
  2. package/tests/nuVal.js +6 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "69.0.1",
3
+ "version": "69.0.2",
4
4
  "description": "Run 1000 web accessibility tests from 11 tools and get a standardized report",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/tests/nuVal.js CHANGED
@@ -56,12 +56,14 @@ exports.reporter = async (page, report, actIndex) => {
56
56
  body: testTarget
57
57
  };
58
58
  const nuURL = 'https://validator.w3.org/nu/?parser=html&out=json';
59
- let nuData;
59
+ let nuData = {};
60
+ let nuResponse = new Response();
60
61
  try {
61
62
  // Get a Nu Html Checker report from the W3C validator service.
62
63
  nuResponse = await fetch(nuURL, fetchOptions);
64
+ const {ok, status, statusText} = nuResponse;
63
65
  // If the acquisition succeeded:
64
- if (nuResponse.ok) {
66
+ if (ok) {
65
67
  // Get the response body as an object.
66
68
  nuData = await nuResponse.json();
67
69
  }
@@ -71,13 +73,13 @@ exports.reporter = async (page, report, actIndex) => {
71
73
  const nuResponseText = await nuResponse.text();
72
74
  // Add a failure report to the data.
73
75
  data.prevented = true;
74
- data.error = `HTTP ${nuResponse.status}: ${nuResponse.statusText} (${nuResponseText.slice(0, 200)})`;
76
+ data.error = `HTTP ${status}: ${statusText} (${nuResponseText?.slice(0, 200)})`;
75
77
  }
76
78
  }
77
79
  // If an error occurred:
78
80
  catch (error) {
79
81
  // Report it.
80
- const message = `ERROR getting results (${error.message}; status ${nuResult?.status || 'none'} (${JSON.stringify(nuData?.body || 'no body', null, 2)})`;
82
+ const message = `ERROR getting results (${error.message}; status ${nuResponse.status || 'none'} (${JSON.stringify(nuData?.body || 'no body', null, 2)})`;
81
83
  console.log(message);
82
84
  data.prevented = true;
83
85
  data.error = message;