testaro 30.0.0 → 30.0.1

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/watch.js +10 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "30.0.0",
3
+ "version": "30.0.1",
4
4
  "description": "Run 960 web accessibility tests from 9 tools and get a standardized report",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/watch.js CHANGED
@@ -59,11 +59,16 @@ const writeDirReport = async report => {
59
59
  }
60
60
  };
61
61
  // Archives a job.
62
- const archiveJob = async job => {
62
+ const archiveJob = async (job, isFile) => {
63
+ // Save the job in the done subdirectory.
63
64
  const {id} = job;
64
65
  const jobJSON = JSON.stringify(job, null, 2);
65
66
  await fs.writeFile(`${jobDir}/done/${id}.json`, jobJSON);
66
- await fs.rm(`${jobDir}/todo/${id}.json`);
67
+ // If the job had been saved as a file in the todo subdirectory:
68
+ if (isFile) {
69
+ // Delete the file.
70
+ await fs.rm(`${jobDir}/todo/${id}.json`);
71
+ }
67
72
  };
68
73
  // Checks for a directory job and, if found, performs and reports it, once or repeatedly.
69
74
  const checkDirJob = async (isForever, interval) => {
@@ -84,7 +89,7 @@ const checkDirJob = async (isForever, interval) => {
84
89
  // Report it.
85
90
  await writeDirReport(job);
86
91
  // Archive it.
87
- await archiveJob(job);
92
+ await archiveJob(job, true);
88
93
  console.log(`Job ${id} archived in ${jobDir} (${nowString()})`);
89
94
  // If watching is repetitive:
90
95
  if (isForever) {
@@ -207,7 +212,7 @@ const checkNetJob = async (servers, serverIndex, isForever, interval, noJobCount
207
212
  // Report it.
208
213
  console.log(`${reportLogStart}${message}`);
209
214
  // Archive the job.
210
- await archiveJob(contentObj);
215
+ await archiveJob(contentObj, false);
211
216
  console.log(`Job ${id} archived (${nowString()})`);
212
217
  // Check the next server.
213
218
  await checkNetJob(servers, serverIndex + 1, isForever, interval, 0);
@@ -228,7 +233,7 @@ const checkNetJob = async (servers, serverIndex, isForever, interval, noJobCount
228
233
  catch(error) {
229
234
  // Report it.
230
235
  console.log(
231
- `ERROR: ${reportLogStart}status ${repResponse.statusCode} and response ${content.slice(0, 1000)}`
236
+ `ERROR: ${reportLogStart}status ${repResponse.statusCode}, error message ${error.message}, and response ${content.slice(0, 1000)}`
232
237
  );
233
238
  // Check the next server, disregarding the failed job.
234
239
  await checkNetJob(