testaro 6.0.1 → 6.0.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/watch.js +18 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "6.0.1",
3
+ "version": "6.0.2",
4
4
  "description": "Automation of accessibility testing",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/watch.js CHANGED
@@ -37,22 +37,27 @@ const reportDir = process.env.REPORTDIR;
37
37
 
38
38
  // Checks for a directory job.
39
39
  const checkDirJob = async () => {
40
- const jobDirFileNames = await fs.readdir(watchDir);
41
- const jobFileNames = jobDirFileNames.filter(fileName => fileName.endsWith('.json'));
42
- if (jobFileNames.length) {
43
- const scriptJSON = await fs.readFile(`${watchDir}/${jobFileNames[0]}`, 'utf8');
44
- try {
45
- const script = JSON.parse(scriptJSON, null, 2);
46
- return script;
40
+ try {
41
+ const jobDirFileNames = await fs.readdir(watchDir);
42
+ const jobFileNames = jobDirFileNames.filter(fileName => fileName.endsWith('.json'));
43
+ if (jobFileNames.length) {
44
+ const scriptJSON = await fs.readFile(`${watchDir}/${jobFileNames[0]}`, 'utf8');
45
+ try {
46
+ const script = JSON.parse(scriptJSON, null, 2);
47
+ return script;
48
+ }
49
+ catch(error) {
50
+ return {
51
+ error: 'ERROR: Script was not JSON',
52
+ message: error.message
53
+ };
54
+ }
47
55
  }
48
- catch(error) {
49
- return {
50
- error: 'ERROR: Script was not JSON',
51
- message: error.message
52
- };
56
+ else {
57
+ return {};
53
58
  }
54
59
  }
55
- else {
60
+ catch {
56
61
  return {};
57
62
  }
58
63
  };