testaro 69.0.0 → 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.
- package/package.json +1 -1
- package/tests/htmlcs.js +2 -2
- package/tests/nuVal.js +6 -4
package/package.json
CHANGED
package/tests/htmlcs.js
CHANGED
|
@@ -126,8 +126,8 @@ exports.reporter = async (page, report, actIndex) => {
|
|
|
126
126
|
// Increment the warning total.
|
|
127
127
|
nativeResult.totals.cantTell++;
|
|
128
128
|
}
|
|
129
|
-
// If standard results are to be reported:
|
|
130
|
-
if (standard) {
|
|
129
|
+
// If standard results are to be reported and the message reports an error or warning:
|
|
130
|
+
if (standard && ['Error', 'Warning'].includes(parts[0])) {
|
|
131
131
|
const instance = {
|
|
132
132
|
ruleID: `${parts[0][0]}-${parts[1]}`,
|
|
133
133
|
what: parts[4],
|
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 (
|
|
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 ${
|
|
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 ${
|
|
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;
|