testilo 17.2.9 → 18.0.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 CHANGED
@@ -362,10 +362,10 @@ A module can invoke `merge` in this way:
362
362
 
363
363
  ```javaScript
364
364
  const {merge} = require('testilo/merge');
365
- const jobs = merge(script, batch, requester, true);
365
+ const jobs = merge(script, batch, requester, 'only', true);
366
366
  ```
367
367
 
368
- 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 isolation; a missing fourth argument is equivalent to `false`. 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.
368
+ 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 string that specifies the Testaro standardization option ('also', 'only', or 'no'). The fifth argument is a boolean, specifying whether to perform isolation; a missing fifth argument is equivalent to `false`. 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.
369
369
 
370
370
  ##### By a user
371
371
 
@@ -374,12 +374,13 @@ A user can invoke `merge` in this way:
374
374
  - Create a script and save it as a JSON file in the `scripts` subdirectory of the `process.env.SPECDIR` directory.
375
375
  - Create a batch and save it as a JSON file in the `batches` subdirectory of the `process.env.SPECDIR` directory.
376
376
  - In the Testilo project directory, execute this statement:
377
- - `node call merge s b e i t`
377
+ - `node call merge s b e o i t`
378
378
 
379
379
  In these statements, replace:
380
380
  - `s` with the base name of the script file
381
381
  - `b` with the base name of the batch file
382
382
  - `e` with an email address, or with an empty string if the environment variable `process.env.REQUESTER` exists and you want to use it
383
+ - `o` with `'also'`, `'only'`, or `'no'` to specify the Testaro standardization option
383
384
  - `i` with `true` if you want test isolation or `false` if not
384
385
  - `t` 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.
385
386
 
package/merge.js CHANGED
@@ -5,7 +5,8 @@
5
5
  0. script
6
6
  1. batch
7
7
  2. requester
8
- 3. whether to provide test isolation (no if omitted)
8
+ 3. value of the standard property
9
+ 4. whether to provide test isolation (no if omitted)
9
10
  */
10
11
 
11
12
  // ########## IMPORTS
@@ -29,7 +30,7 @@ const contaminantNames = new Set([
29
30
  // ########## FUNCTIONS
30
31
 
31
32
  // Merges a script and a batch and returns jobs.
32
- exports.merge = (script, batch, requester, isolate = false) => {
33
+ exports.merge = (script, batch, requester, standard, isolate = false) => {
33
34
  if (isolate === 'false') {
34
35
  isolate = false;
35
36
  }
@@ -58,6 +59,8 @@ exports.merge = (script, batch, requester, isolate = false) => {
58
59
  // Add time properties to the job.
59
60
  protoJob.creationTime = creationTime;
60
61
  protoJob.timeStamp = timeStamp;
62
+ // Add the standardization option to the job.
63
+ protoJob.standard = standard || 'only';
61
64
  // If isolation was requested:
62
65
  if (isolate) {
63
66
  // Perform it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testilo",
3
- "version": "17.2.9",
3
+ "version": "18.0.0",
4
4
  "description": "Prepares and processes Testaro reports",
5
5
  "main": "aim.js",
6
6
  "scripts": {
@@ -0,0 +1,12 @@
1
+ /*
2
+ toolScores.js
3
+ Tabulates tool scores from a report.
4
+ */
5
+ const report = require(`${__dirname}/../../../testejo/reports/scored/${process.argv[2]}.json`);
6
+ const toolCounts = report.score.details.severity.byTool;
7
+ const result = {};
8
+ Object.keys(toolCounts).forEach(toolID => {
9
+ result[toolID] = toolCounts[toolID]
10
+ .reduce((total, current, index) => total + (index + 1) * current, 0);
11
+ });
12
+ console.log(JSON.stringify(result, null, 2));