testaro 12.4.0 → 12.4.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/dupAtt.js +9 -1
- package/watch.js +14 -10
- package/dupAtt/temp.html +0 -19
package/package.json
CHANGED
package/tests/dupAtt.js
CHANGED
|
@@ -28,7 +28,15 @@ exports.reporter = async (page, withItems) => {
|
|
|
28
28
|
rawPage = await fs.readFile(filePath, 'utf8');
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
|
-
|
|
31
|
+
try {
|
|
32
|
+
const rawPageResponse = await fetch(url);
|
|
33
|
+
rawPage = await rawPageResponse.text();
|
|
34
|
+
}
|
|
35
|
+
catch(error) {
|
|
36
|
+
console.log(`ERROR getting page for dupAtt test (${error.message})`);
|
|
37
|
+
data.prevented = true;
|
|
38
|
+
return {result: data};
|
|
39
|
+
}
|
|
32
40
|
}
|
|
33
41
|
// Extract its elements, in a uniform format.
|
|
34
42
|
const elements = rawPage
|
package/watch.js
CHANGED
|
@@ -24,6 +24,8 @@ const reportDir = process.env.REPORTDIR;
|
|
|
24
24
|
|
|
25
25
|
// ########## FUNCTIONS
|
|
26
26
|
|
|
27
|
+
// Returns a string representing the date and time.
|
|
28
|
+
const nowString = () => (new Date()).toISOString().slice(0, 19);
|
|
27
29
|
// Checks for a directory job.
|
|
28
30
|
const checkDirJob = async watchee => {
|
|
29
31
|
try {
|
|
@@ -44,12 +46,12 @@ const checkDirJob = async watchee => {
|
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
else {
|
|
47
|
-
console.log(
|
|
49
|
+
console.log(`No job to do (${nowString()})`);
|
|
48
50
|
return {};
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
catch(error) {
|
|
52
|
-
console.log(
|
|
54
|
+
console.log('ERROR: Directory watching failed');
|
|
53
55
|
return {};
|
|
54
56
|
}
|
|
55
57
|
};
|
|
@@ -86,13 +88,13 @@ const checkNetJob = async watchee => {
|
|
|
86
88
|
request.end();
|
|
87
89
|
});
|
|
88
90
|
if (job.id) {
|
|
89
|
-
console.log(`Network job ${job.id} received`);
|
|
91
|
+
console.log(`Network job ${job.id} received (${nowString()})`);
|
|
90
92
|
}
|
|
91
93
|
else if (job.message) {
|
|
92
94
|
console.log(job.message);
|
|
93
95
|
}
|
|
94
96
|
else {
|
|
95
|
-
console.log(
|
|
97
|
+
console.log(`No network job to do (${nowString()})`);
|
|
96
98
|
}
|
|
97
99
|
return job;
|
|
98
100
|
};
|
|
@@ -155,7 +157,7 @@ const writeNetReport = async report => {
|
|
|
155
157
|
const reportJSON = JSON.stringify(report, null, 2);
|
|
156
158
|
request.write(reportJSON);
|
|
157
159
|
request.end();
|
|
158
|
-
console.log(`Report ${report.id} submitted`);
|
|
160
|
+
console.log(`Report ${report.id} submitted (${nowString()})`);
|
|
159
161
|
}
|
|
160
162
|
else {
|
|
161
163
|
console.log('ERROR: Report has no sources property');
|
|
@@ -217,7 +219,9 @@ exports.cycle = async (isDirWatch, isForever, interval, watchee = null) => {
|
|
|
217
219
|
let statusOK = true;
|
|
218
220
|
// Prevent a wait before the first iteration.
|
|
219
221
|
let empty = false;
|
|
220
|
-
console.log(
|
|
222
|
+
console.log(
|
|
223
|
+
`Watching started with intervals of ${interval} seconds when idle (${nowString()})`
|
|
224
|
+
);
|
|
221
225
|
while (statusOK) {
|
|
222
226
|
if (empty) {
|
|
223
227
|
await wait(intervalMS);
|
|
@@ -233,14 +237,14 @@ exports.cycle = async (isDirWatch, isForever, interval, watchee = null) => {
|
|
|
233
237
|
// If there was one:
|
|
234
238
|
if (job.id) {
|
|
235
239
|
// Run it, save a report, and if applicable send the report to the job source.
|
|
236
|
-
console.log(`Running job ${job.id}`);
|
|
240
|
+
console.log(`Running job ${job.id} (${nowString()})`);
|
|
237
241
|
await runJob(JSON.parse(JSON.stringify(job)), isDirWatch);
|
|
238
|
-
console.log(`Job ${job.id} finished`);
|
|
242
|
+
console.log(`Job ${job.id} finished (${nowString()})`);
|
|
239
243
|
// If a directory was watched:
|
|
240
244
|
if (isDirWatch) {
|
|
241
245
|
// Archive the job.
|
|
242
246
|
await archiveJob(job, watchee);
|
|
243
|
-
console.log(`Job ${job.id} archived`);
|
|
247
|
+
console.log(`Job ${job.id} archived (${nowString()})`);
|
|
244
248
|
}
|
|
245
249
|
// If watching was specified for only 1 job, quit.
|
|
246
250
|
statusOK = isForever;
|
|
@@ -253,5 +257,5 @@ exports.cycle = async (isDirWatch, isForever, interval, watchee = null) => {
|
|
|
253
257
|
empty = true;
|
|
254
258
|
}
|
|
255
259
|
}
|
|
256
|
-
console.log(
|
|
260
|
+
console.log(`Watching ended (${nowString()})`);
|
|
257
261
|
};
|
package/dupAtt/temp.html
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en-US">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>Test page</title>
|
|
6
|
-
<meta name="description" content="tester">
|
|
7
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<main>
|
|
11
|
-
<h1>Test page</h1>
|
|
12
|
-
<p><button id="violator" width="4rem" width="10rem">Submit</button></p>
|
|
13
|
-
<p
|
|
14
|
-
aria-label="large"
|
|
15
|
-
aria-label="small"
|
|
16
|
-
>A paragraph</p>
|
|
17
|
-
</main>
|
|
18
|
-
</body>
|
|
19
|
-
</html>
|