testaro 28.2.5 → 29.0.0
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/README.md +1 -1
- package/package.json +1 -1
- package/run.js +6 -4
- package/tests/testaro.js +9 -7
package/README.md
CHANGED
|
@@ -221,7 +221,7 @@ Testaro helps overcome this format diversity by offering to represent the main f
|
|
|
221
221
|
|
|
222
222
|
In the conceptual scheme underlying the format standardization of Testaro, each tool has its own set of _rules_, where a rule is an algorithm for evaluating a target and determining whether instances of some kind of problem exist in it. With standardization, Testaro reports, in a uniform way, the outcomes from the application of rules by tools to a target.
|
|
223
223
|
|
|
224
|
-
|
|
224
|
+
Each job can specify how Testaro is to handle report standardization. A job can contain a `standard` property. If the value of that property is `'also'` or `'only'`, Testaro converts some data in each tool report to the standard format. That permits you to ignore the format idiosyncrasies of the tools. If `standard` has the value `'also'`, the job report includes both formats. If the value is `'only'`, the job report includes only the standard format. If the value is `'no'` (or anything else, or there is no `standard` property), the job report includes only the original format of each tool report.
|
|
225
225
|
|
|
226
226
|
The standard format of each tool report has these properties:
|
|
227
227
|
- `prevented`: `true` if the tool failed to run on the page, or otherwise omitted.
|
package/package.json
CHANGED
package/run.js
CHANGED
|
@@ -22,8 +22,6 @@ const {tellServer} = require('./procs/tellServer');
|
|
|
22
22
|
const debug = process.env.DEBUG === 'true';
|
|
23
23
|
// Set WAITS environment variable to a positive number to insert delays (in ms).
|
|
24
24
|
const waits = Number.parseInt(process.env.WAITS) || 0;
|
|
25
|
-
// Set STANDARD environment variable to also if not set.
|
|
26
|
-
process.env.STANDARD ??= 'also';
|
|
27
25
|
// CSS selectors for targets of moves.
|
|
28
26
|
const moves = {
|
|
29
27
|
button: 'button, [role=button], input[type=submit]',
|
|
@@ -732,7 +730,7 @@ const doActs = async (report, actIndex, page) => {
|
|
|
732
730
|
const resultCount = Object.keys(toolReport.result).length;
|
|
733
731
|
act.result = resultCount ? toolReport.result : {success: false};
|
|
734
732
|
// If a standard-format result is to be included in the report:
|
|
735
|
-
const standard =
|
|
733
|
+
const standard = report.standard || 'only';
|
|
736
734
|
if (['also', 'only'].includes(standard)) {
|
|
737
735
|
// Initialize it.
|
|
738
736
|
act.standardResult = {
|
|
@@ -743,7 +741,11 @@ const doActs = async (report, actIndex, page) => {
|
|
|
743
741
|
standardize(act);
|
|
744
742
|
// If the original-format result is not to be included in the report:
|
|
745
743
|
if (standard === 'only') {
|
|
746
|
-
// Remove it.
|
|
744
|
+
// Remove it, except any important property.
|
|
745
|
+
if (act.result.important) {
|
|
746
|
+
act.data = act.result.important;
|
|
747
|
+
console.log('>>>>>> Important result data protected from deletion');
|
|
748
|
+
}
|
|
747
749
|
delete act.result;
|
|
748
750
|
}
|
|
749
751
|
// If the test has expectations:
|
package/tests/testaro.js
CHANGED
|
@@ -107,9 +107,11 @@ exports.reporter = async (page, options) => {
|
|
|
107
107
|
// Initialize the data.
|
|
108
108
|
const data = {
|
|
109
109
|
rules: {},
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
important: {
|
|
111
|
+
preventions: [],
|
|
112
|
+
invalid: [],
|
|
113
|
+
testTimes: {}
|
|
114
|
+
}
|
|
113
115
|
};
|
|
114
116
|
// If the rule specification is valid:
|
|
115
117
|
if (
|
|
@@ -163,7 +165,7 @@ exports.reporter = async (page, options) => {
|
|
|
163
165
|
});
|
|
164
166
|
data.rules[rule].totals = data.rules[rule].totals.map(total => Math.round(total));
|
|
165
167
|
if (ruleReport.prevented) {
|
|
166
|
-
data.preventions.push(rule);
|
|
168
|
+
data.important.preventions.push(rule);
|
|
167
169
|
}
|
|
168
170
|
// If testing is to stop after a failure and the page failed the test:
|
|
169
171
|
if (stopOnFail && ruleReport.totals.some(total => total)) {
|
|
@@ -174,19 +176,19 @@ exports.reporter = async (page, options) => {
|
|
|
174
176
|
// If an error is thrown by the test:
|
|
175
177
|
catch(error) {
|
|
176
178
|
// Report this.
|
|
177
|
-
data.preventions.push(rule);
|
|
179
|
+
data.important.preventions.push(rule);
|
|
178
180
|
console.log(`ERROR: Test of testaro rule ${rule} prevented (${error.message})`);
|
|
179
181
|
}
|
|
180
182
|
}
|
|
181
183
|
// Otherwise, i.e. if the rule is undefined or doubly defined:
|
|
182
184
|
else {
|
|
183
185
|
// Report this.
|
|
184
|
-
data.invalid.push(rule);
|
|
186
|
+
data.important.invalid.push(rule);
|
|
185
187
|
console.log(`ERROR: Rule ${rule} not validly defined`);
|
|
186
188
|
}
|
|
187
189
|
}
|
|
188
190
|
testTimes.sort((a, b) => b[1] - a[1]).forEach(pair => {
|
|
189
|
-
data.testTimes[pair[0]] = pair[1];
|
|
191
|
+
data.important.testTimes[pair[0]] = pair[1];
|
|
190
192
|
});
|
|
191
193
|
}
|
|
192
194
|
// Otherwise, i.e. if the rule specification is invalid:
|