testaro 30.0.2 → 30.0.4

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 +11 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "30.0.2",
3
+ "version": "30.0.4",
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
@@ -119,7 +119,6 @@ const checkDirJob = async (isForever, interval) => {
119
119
  };
120
120
  // Checks servers for a network job.
121
121
  const checkNetJob = async (servers, serverIndex, isForever, interval, noJobCount) => {
122
- console.log('');
123
122
  // If all servers are jobless:
124
123
  if (noJobCount === servers.length) {
125
124
  // Wait for the specified interval.
@@ -132,8 +131,13 @@ const checkNetJob = async (servers, serverIndex, isForever, interval, noJobCount
132
131
  // Wait 2 seconds.
133
132
  await wait(2000);
134
133
  }
135
- // Check the next server.
134
+ // If the last server has been checked:
136
135
  serverIndex = serverIndex % servers.length;
136
+ if (serverIndex === 0) {
137
+ // Report this.
138
+ console.log('--');
139
+ }
140
+ // Check the next server.
137
141
  const server = servers[serverIndex];
138
142
  const client = server.startsWith('https://') ? httpsClient : httpClient;
139
143
  const fullURL = `${server}?agent=${agent}`;
@@ -156,7 +160,7 @@ const checkNetJob = async (servers, serverIndex, isForever, interval, noJobCount
156
160
  const content = chunks.join('');
157
161
  // If there was no job to do:
158
162
  try {
159
- const contentObj = JSON.parse(content);
163
+ let contentObj = JSON.parse(content);
160
164
  if (! Object.keys(contentObj).length) {
161
165
  // Report this.
162
166
  console.log(`No job to do at ${server}`);
@@ -183,7 +187,7 @@ const checkNetJob = async (servers, serverIndex, isForever, interval, noJobCount
183
187
  // Perform the job, adding result data to it.
184
188
  console.log(`${logStart}job ${id} for ${sendReportTo} (${nowString()})`);
185
189
  await doJob(contentObj);
186
- const reportJSON = JSON.stringify(contentObj, null, 2);
190
+ let reportJSON = JSON.stringify(contentObj, null, 2);
187
191
  console.log(`Job ${id} finished (${nowString()})`);
188
192
  // Send the report to the specified server.
189
193
  console.log(`Sending report ${id} to ${sendReportTo}`);
@@ -212,9 +216,9 @@ const checkNetJob = async (servers, serverIndex, isForever, interval, noJobCount
212
216
  if (message) {
213
217
  // Report it.
214
218
  console.log(`${reportLogStart}${message}`);
215
- // Archive the job.
216
- await archiveJob(contentObj, false);
217
- console.log(`Job ${id} archived (${nowString()})`);
219
+ // Free the memory used by the report.
220
+ reportJSON = '';
221
+ contentObj = {};
218
222
  // Check the next server.
219
223
  await checkNetJob(servers, serverIndex + 1, isForever, interval, 0);
220
224
  }