testaro 8.4.3 → 8.4.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 (4) hide show
  1. package/call.js +4 -2
  2. package/high.js +12 -5
  3. package/package.json +1 -1
  4. package/run.js +4 -2
package/call.js CHANGED
@@ -29,8 +29,10 @@ const reportDir = process.env.REPORTDIR;
29
29
 
30
30
  // Fulfills a high-level testing request.
31
31
  const callHigh = async jobID => {
32
- await runJob(jobID);
33
- console.log(`Job completed and report ${jobID}.json saved in ${reportDir}`);
32
+ const done = await runJob(jobID);
33
+ if (done) {
34
+ console.log(`Job completed and report ${jobID}.json saved in ${reportDir}`);
35
+ }
34
36
  };
35
37
  // Starts a watch.
36
38
  const callWatch = async (isDirWatch, isForever, interval) => {
package/high.js CHANGED
@@ -41,13 +41,20 @@ exports.runJob = async jobID => {
41
41
  acts: [],
42
42
  jobData: {}
43
43
  };
44
- // Run the job, adding the results to the report.
45
- await doJob(report);
46
- const reportJSON = JSON.stringify(report, null, 2);
47
- await fs.writeFile(`${reportDir}/${jobID}.json`, reportJSON);
48
- console.log(`Report ${jobID}.json recorded in ${process.env.REPORTDIR}`);
44
+ // If the initialized report is valid, run the job, adding the results to the report.
45
+ const done = await doJob(report);
46
+ if (done) {
47
+ const reportJSON = JSON.stringify(report, null, 2);
48
+ await fs.writeFile(`${reportDir}/${jobID}.json`, reportJSON);
49
+ console.log(`Report ${jobID}.json recorded in ${process.env.REPORTDIR}`);
50
+ return true;
51
+ }
52
+ else {
53
+ return false;
54
+ }
49
55
  }
50
56
  catch(error) {
51
57
  console.log(`ERROR running job (${error.message})\n${error.stack}`);
58
+ return false;
52
59
  }
53
60
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "8.4.3",
3
+ "version": "8.4.5",
4
4
  "description": "Automation of accessibility testing",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/run.js CHANGED
@@ -263,8 +263,8 @@ const isValidReport = report => {
263
263
  [commands[1].which, 'second command has which property'],
264
264
  [isURL(commands[1].which), 'second command which property has URL value'],
265
265
  [commands.every(command => isValidCommand(command)), 'every command is valid'],
266
- [typeof sources.script === 'string', 'sources has script property with string value'],
267
- [sources.host, 'sources has host property']
266
+ [sources && typeof sources.script === 'string', 'sources has script property with string value'],
267
+ [sources && sources.host, 'sources has host property']
268
268
  ];
269
269
  const invalidityIndex = criteria.findIndex(criterion => ! criterion[0]);
270
270
  if (invalidityIndex > -1) {
@@ -1560,8 +1560,10 @@ exports.doJob = async report => {
1560
1560
  const endTime = new Date();
1561
1561
  report.jobData.endTime = nowString();
1562
1562
  report.jobData.elapsedSeconds = Math.floor((endTime - startTime) / 1000);
1563
+ return true;
1563
1564
  }
1564
1565
  else {
1565
1566
  console.log('ERROR: Initialized job report invalid');
1567
+ return false;
1566
1568
  }
1567
1569
  };