testaro 30.0.3 → 30.0.5

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 +16 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "30.0.3",
3
+ "version": "30.0.5",
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}`);
@@ -174,16 +178,19 @@ const checkNetJob = async (servers, serverIndex, isForever, interval, noJobCount
174
178
  await checkNetJob(servers, serverIndex + 1, isForever, interval, noJobCount + 1);
175
179
  }
176
180
  // Otherwise, if the server sent a valid job:
177
- else if (id && sources) {
181
+ else if (id && sources && sources.target && sources.target.which) {
178
182
  // Add the agent to it.
179
183
  sources.agent = agent;
180
184
  // If the job specifies a report destination:
181
185
  const {sendReportTo} = sources;
182
186
  if (sendReportTo) {
183
187
  // Perform the job, adding result data to it.
184
- console.log(`${logStart}job ${id} for ${sendReportTo} (${nowString()})`);
188
+ const testee = sources.target.which;
189
+ console.log(
190
+ `${logStart}job ${id} (${nowString()})\n>> It will test ${testee}\n>> It will send report to ${sendReportTo}`
191
+ );
185
192
  await doJob(contentObj);
186
- const reportJSON = JSON.stringify(contentObj, null, 2);
193
+ let reportJSON = JSON.stringify(contentObj, null, 2);
187
194
  console.log(`Job ${id} finished (${nowString()})`);
188
195
  // Send the report to the specified server.
189
196
  console.log(`Sending report ${id} to ${sendReportTo}`);
@@ -212,9 +219,9 @@ const checkNetJob = async (servers, serverIndex, isForever, interval, noJobCount
212
219
  if (message) {
213
220
  // Report it.
214
221
  console.log(`${reportLogStart}${message}`);
215
- // Archive the job.
216
- await archiveJob(contentObj, false);
217
- console.log(`Job ${id} archived (${nowString()})`);
222
+ // Free the memory used by the report.
223
+ reportJSON = '';
224
+ contentObj = {};
218
225
  // Check the next server.
219
226
  await checkNetJob(servers, serverIndex + 1, isForever, interval, 0);
220
227
  }