testilo 22.0.5 → 22.1.0
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/README.md +14 -10
- package/call.js +4 -2
- package/merge.js +7 -3
- package/package.json +1 -1
- package/validation/merge/validate.js +2 -2
package/README.md
CHANGED
|
@@ -379,10 +379,12 @@ A module can invoke `merge` in this way:
|
|
|
379
379
|
|
|
380
380
|
```javaScript
|
|
381
381
|
const {merge} = require('testilo/merge');
|
|
382
|
-
const jobs = merge(script, batch, requester, true, 'only', false, '240115T1200');
|
|
382
|
+
const jobs = merge(script, batch, requester, true, 'only', false, '240115T1200', 'jobs/', '.json');
|
|
383
383
|
```
|
|
384
384
|
|
|
385
|
-
This invocation references `script`, `batch`, and `requester` variables that the module must have already defined. The `script` and `batch` variables are a script object and a batch object, respectively. The `requester` variable is an email address. The fourth argument is a boolean, specifying whether to perform test isolation. The fifth argument is a string that specifies the Testaro standardization option ('also', 'only', or 'no'). The sixth argument is a boolean, specifying whether Testaro will allow granular network
|
|
385
|
+
This invocation references `script`, `batch`, and `requester` variables that the module must have already defined. The `script` and `batch` variables are a script object and a batch object, respectively. The `requester` variable is an email address. The fourth argument is a boolean, specifying whether to perform test isolation. The fifth argument is a string that specifies the Testaro standardization option ('also', 'only', or 'no'). The sixth argument is a boolean, specifying whether Testaro will allow granular network observation of the job. The seventh and eights arguments are strings that contain the parts, before and after the job ID, respectively, of the absolute or relative URL for retrieving the job report. In this case, a job with ID `20240420T1426-R7T-archive` will produce a report that can be retrieved at the relative URL `jobs/20240420T1426-R7T-archive.json`.
|
|
386
|
+
|
|
387
|
+
The `merge()` function of the `merge` module generates jobs and returns them in an array. The invoking module can further dispose of the jobs as needed.
|
|
386
388
|
|
|
387
389
|
##### By a user
|
|
388
390
|
|
|
@@ -391,16 +393,18 @@ A user can invoke `merge` in this way:
|
|
|
391
393
|
- Create a script and save it as a JSON file in the `scripts` subdirectory of the `process.env.SPECDIR` directory.
|
|
392
394
|
- Create a batch and save it as a JSON file in the `batches` subdirectory of the `process.env.SPECDIR` directory.
|
|
393
395
|
- In the Testilo project directory, execute this statement:
|
|
394
|
-
- `node call merge
|
|
396
|
+
- `node call merge scriptName batchName email isolate standard granular todoDir pre post`
|
|
395
397
|
|
|
396
398
|
In these statements, replace:
|
|
397
|
-
- `
|
|
398
|
-
- `
|
|
399
|
-
- `
|
|
400
|
-
- `
|
|
401
|
-
- `
|
|
402
|
-
- `
|
|
403
|
-
- `
|
|
399
|
+
- `scriptName` with the base name of the script file
|
|
400
|
+
- `batchName` with the base name of the batch file
|
|
401
|
+
- `email` with an email address, or with an empty string if the environment variable `process.env.REQUESTER` exists and you want to use it
|
|
402
|
+
- `isolate` with `true` if you want test isolation or `false` if not
|
|
403
|
+
- `standard` with `'also'`, `'only'`, or `'no'` to specify the treatment of standard-format results.
|
|
404
|
+
- `granular` with `true` if granular observation is to be permitted, or `false` if not.
|
|
405
|
+
- `todoDir` with `true` if the job is to be saved in the `todo` subdirectory or `false` if it is to be saved in the `pending` subdirectory of the `process.env.JOBDIR` directory.
|
|
406
|
+
- `pre` with the pre-ID part of the report URL.
|
|
407
|
+
- `post` with the post-ID part of the report URL.
|
|
404
408
|
|
|
405
409
|
The `call` module will retrieve the named script and batch from their respective directories.
|
|
406
410
|
The `merge` module will create an array of jobs, with or without test isolation.
|
package/call.js
CHANGED
|
@@ -85,7 +85,9 @@ const callMerge = async (
|
|
|
85
85
|
const batchJSON = await fs.readFile(`${specDir}/batches/${batchID}.json`, 'utf8');
|
|
86
86
|
const batch = JSON.parse(batchJSON);
|
|
87
87
|
// Merge them into an array of jobs.
|
|
88
|
-
const jobs = merge(
|
|
88
|
+
const jobs = merge(
|
|
89
|
+
script, batch, requester, withIsolation, standard, isGranular, null, urlPrefix, urlSuffix
|
|
90
|
+
);
|
|
89
91
|
// Save the jobs.
|
|
90
92
|
const destination = todo === 'true' ? 'todo' : 'pending';
|
|
91
93
|
for (const job of jobs) {
|
|
@@ -245,7 +247,7 @@ else if (fn === 'script' && fnArgs.length) {
|
|
|
245
247
|
console.log('Execution completed');
|
|
246
248
|
});
|
|
247
249
|
}
|
|
248
|
-
else if (fn === 'merge' && fnArgs.length ===
|
|
250
|
+
else if (fn === 'merge' && fnArgs.length === 9) {
|
|
249
251
|
callMerge(... fnArgs)
|
|
250
252
|
.then(() => {
|
|
251
253
|
console.log('Execution completed');
|
package/merge.js
CHANGED
|
@@ -71,7 +71,9 @@ const getRandomID = length => {
|
|
|
71
71
|
return chars.join('');
|
|
72
72
|
};
|
|
73
73
|
// Merges a script and a batch and returns jobs.
|
|
74
|
-
exports.merge = (
|
|
74
|
+
exports.merge = (
|
|
75
|
+
script, batch, requester, isolate, standard, observe, timeStamp, urlPrefix, urlSuffix
|
|
76
|
+
) => {
|
|
75
77
|
if (isolate === 'false') {
|
|
76
78
|
isolate = false;
|
|
77
79
|
}
|
|
@@ -107,7 +109,8 @@ exports.merge = (script, batch, requester, isolate, standard, observe, timeStamp
|
|
|
107
109
|
what: ''
|
|
108
110
|
},
|
|
109
111
|
requester,
|
|
110
|
-
sendReportTo: process.env.REPORT_URL || ''
|
|
112
|
+
sendReportTo: process.env.REPORT_URL || '',
|
|
113
|
+
url: ''
|
|
111
114
|
};
|
|
112
115
|
// Add properties to the job.
|
|
113
116
|
protoJob.creationTime = creationTime;
|
|
@@ -149,10 +152,11 @@ exports.merge = (script, batch, requester, isolate, standard, observe, timeStamp
|
|
|
149
152
|
const job = JSON.parse(JSON.stringify(protoJob));
|
|
150
153
|
// Append the target ID to the job ID.
|
|
151
154
|
job.id += target.id;
|
|
152
|
-
// Add data
|
|
155
|
+
// Add data to the sources property of the job.
|
|
153
156
|
job.sources.target.id = target.id;
|
|
154
157
|
job.sources.target.which = target.which;
|
|
155
158
|
job.sources.target.what = target.what;
|
|
159
|
+
job.sources.url = `${urlPrefix}${job.id}${urlSuffix}`;
|
|
156
160
|
// Replace each placeholder object in the job with the named replacer array of the target.
|
|
157
161
|
let {acts} = job;
|
|
158
162
|
for (const actIndex in acts) {
|
package/package.json
CHANGED
|
@@ -21,8 +21,8 @@ const validate = async () => {
|
|
|
21
21
|
const batch = JSON.parse(batchJSON);
|
|
22
22
|
const requester = 'me@mydomain.tld';
|
|
23
23
|
// Perform the merger without and with isolation.
|
|
24
|
-
const jobsNoIsolation = merge(script, batch, requester, false);
|
|
25
|
-
const jobsYesIsolation = merge(script, batch, requester, true);
|
|
24
|
+
const jobsNoIsolation = merge(script, batch, requester, false, 'no', false, '', 'reports/', '');
|
|
25
|
+
const jobsYesIsolation = merge(script, batch, requester, true, 'no', false, '', 'reports/', '');
|
|
26
26
|
const jobArrays = [jobsNoIsolation, jobsYesIsolation];
|
|
27
27
|
// Validate the jobs.
|
|
28
28
|
if (jobsNoIsolation && jobsYesIsolation) {
|