testilo 3.1.2 → 3.3.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.
@@ -64,6 +64,10 @@ legend {
64
64
  section:not(.wide) {
65
65
  max-width: 36rem;
66
66
  }
67
+ #summary > p {
68
+ margin: 0;
69
+ padding: 0;
70
+ }
67
71
  table {
68
72
  border-collapse: collapse;
69
73
  }
@@ -1,5 +1,10 @@
1
1
  {
2
2
  "id": "35k1r-railpass",
3
+ "host": {
4
+ "id": "railpass",
5
+ "which": "https://www.railpass.com/",
6
+ "what": "Railpass"
7
+ },
3
8
  "log": [
4
9
  {
5
10
  "event": "startTime",
@@ -11,7 +16,7 @@
11
16
  }
12
17
  ],
13
18
  "script": {
14
- "id": "asp10",
19
+ "id": "tp10",
15
20
  "what": "AATT, Alfa, Axe, IBM, Tenon, WAVE, and 16 custom tests",
16
21
  "strict": true,
17
22
  "commands": [
@@ -1,5 +1,10 @@
1
1
  {
2
2
  "id": "35k1r-railpass",
3
+ "host": {
4
+ "id": "railpass",
5
+ "which": "https://www.railpass.com/",
6
+ "what": "Railpass"
7
+ },
3
8
  "log": [
4
9
  {
5
10
  "event": "startTime",
@@ -11,7 +16,7 @@
11
16
  }
12
17
  ],
13
18
  "script": {
14
- "id": "asp10",
19
+ "id": "tp10",
15
20
  "what": "AATT, Alfa, Axe, IBM, Tenon, WAVE, and 16 custom tests",
16
21
  "strict": true,
17
22
  "commands": [
@@ -8785,7 +8790,7 @@
8785
8790
  "endTime": "2022-06-03T15:25:21",
8786
8791
  "elapsedSeconds": 99,
8787
8792
  "score": {
8788
- "scoreProcID": "tsp10a",
8793
+ "scoreProcID": "sp10a",
8789
8794
  "duplications": {
8790
8795
  "aatt": {
8791
8796
  "e:F77": 1,
package/score.js CHANGED
@@ -1,6 +1,7 @@
1
1
  /*
2
2
  score.js
3
3
  Testilo scoring script.
4
+ Usage example: node score 35k1r-railpass sp10a
4
5
  */
5
6
 
6
7
  // ########## IMPORTS
@@ -8,26 +9,33 @@
8
9
  // Module to keep secrets.
9
10
  require('dotenv').config();
10
11
  // Module to read and write files.
11
- const fs = require('fs').promises;
12
+ const fs = require('fs/promises');
12
13
 
13
14
  // ########## CONSTANTS
14
15
 
15
16
  const reportDirRaw = process.env.REPORTDIR_RAW || 'reports/raw';
16
17
  const reportDirScored = process.env.REPORTDIR_SCORED || 'reports/scored';
17
- const reportID = process.argv[2];
18
+ const reportIDStart = process.argv[2];
18
19
  const scoreProcID = process.argv[3];
19
20
 
20
21
  // ########## FUNCTIONS
21
22
 
22
23
  const score = async () => {
23
- const reportJSON = await fs.readFile(`${__dirname}/${reportDirRaw}/${reportID}.json`, 'utf8');
24
- const report = JSON.parse(reportJSON);
24
+ const reportDirRawAbs = `${__dirname}/${reportDirRaw}`;
25
+ const allReportFileNames = await fs.readdir(reportDirRawAbs);
26
+ const sourceReportFileNames = allReportFileNames
27
+ .filter(fileName => fileName.startsWith(reportIDStart) && fileName.endsWith('.json'));
25
28
  const {scorer} = require(`./procs/score/${scoreProcID}`);
26
- scorer(report);
27
- report.score.scoreProcID = scoreProcID;
28
- const scoredReportJSON = JSON.stringify(report, null, 2);
29
- await fs.writeFile(`${__dirname}/${reportDirScored}/${reportID}.json`, scoredReportJSON);
30
- console.log(`Report ${reportID} scored and saved`);
29
+ for (const fileName of sourceReportFileNames) {
30
+ const reportJSON = await fs
31
+ .readFile(`${reportDirRawAbs}/${fileName}`, 'utf8');
32
+ const report = JSON.parse(reportJSON);
33
+ scorer(report);
34
+ report.score.scoreProcID = scoreProcID;
35
+ const scoredReportJSON = JSON.stringify(report, null, 2);
36
+ await fs.writeFile(`${__dirname}/${reportDirScored}/${fileName}`, `${scoredReportJSON}\n`);
37
+ console.log(`Report ${fileName.slice(0, -5)} scored and saved`);
38
+ };
31
39
  };
32
40
 
33
41
  // ########## OPERATION