testaro 6.0.1 → 6.0.3
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.
- package/commands.js +2 -1
- package/package.json +1 -1
- package/watch.js +18 -13
package/commands.js
CHANGED
|
@@ -139,7 +139,8 @@ exports.commands = {
|
|
|
139
139
|
'Navigate to a new URL',
|
|
140
140
|
{
|
|
141
141
|
which: [true, 'string', 'isURL', 'URL'],
|
|
142
|
-
what: [false, 'string', 'hasLength', 'comment']
|
|
142
|
+
what: [false, 'string', 'hasLength', 'comment'],
|
|
143
|
+
id: [false, 'string', 'hasLength', 'ID of the host']
|
|
143
144
|
}
|
|
144
145
|
],
|
|
145
146
|
wait: [
|
package/package.json
CHANGED
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
49
|
-
return {
|
|
50
|
-
error: 'ERROR: Script was not JSON',
|
|
51
|
-
message: error.message
|
|
52
|
-
};
|
|
56
|
+
else {
|
|
57
|
+
return {};
|
|
53
58
|
}
|
|
54
59
|
}
|
|
55
|
-
|
|
60
|
+
catch {
|
|
56
61
|
return {};
|
|
57
62
|
}
|
|
58
63
|
};
|