testilo 6.1.1 → 6.1.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.
Files changed (3) hide show
  1. package/aim.js +0 -4
  2. package/package.json +1 -1
  3. package/score.js +3 -4
package/aim.js CHANGED
@@ -16,8 +16,6 @@ const scriptDir = process.env.SCRIPTDIR || 'scripts';
16
16
 
17
17
  // ########## FUNCTIONS
18
18
 
19
- // Returns a string representing the date and time.
20
- const nowString = () => (new Date()).toISOString().slice(0, 19);
21
19
  // Returns a script, aimed at a host.
22
20
  exports.aim = async (scriptName, host, requester) => {
23
21
  // Copy the script.
@@ -41,8 +39,6 @@ exports.aim = async (scriptName, host, requester) => {
41
39
  const timeStamp = Math.floor((Date.now() - Date.UTC(2022, 1)) / 2000).toString(36);
42
40
  // Change the script id property to include the time stamp and the host ID.
43
41
  script.id = `${timeStamp}-${script.id}-${host.id}`;
44
- // Add the job-creation time to the script.
45
- script.jobCreationTime = nowString();
46
42
  // Return the host-specific script.
47
43
  return script;
48
44
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testilo",
3
- "version": "6.1.1",
3
+ "version": "6.1.3",
4
4
  "description": "Client that scores and digests Testaro reports",
5
5
  "main": "aim.js",
6
6
  "scripts": {
package/score.js CHANGED
@@ -27,8 +27,7 @@ const reportDirScored = process.env.REPORTDIR_SCORED || 'reports/scored';
27
27
  // Score the specified reports and return their count.
28
28
  exports.score = async (scoreProcID, reportIDStart) => {
29
29
  // Identify the reports to be scored.
30
- const reportDirRawAbs = `${__dirname}/${reportDirRaw}`;
31
- let reportFileNames = await fs.readdir(reportDirRawAbs);
30
+ let reportFileNames = await fs.readdir(reportDirRaw);
32
31
  reportFileNames = reportFileNames.filter(fileName => fileName.endsWith('.json'));
33
32
  if (reportIDStart) {
34
33
  reportFileNames = reportFileNames.filter(fileName => fileName.startsWith(reportIDStart));
@@ -37,13 +36,13 @@ exports.score = async (scoreProcID, reportIDStart) => {
37
36
  const {scorer} = require(`./procs/score/${scoreProcID}`);
38
37
  for (const fileName of reportFileNames) {
39
38
  // Score it.
40
- const reportJSON = await fs.readFile(`${reportDirRawAbs}/${fileName}`, 'utf8');
39
+ const reportJSON = await fs.readFile(`${reportDirRaw}/${fileName}`, 'utf8');
41
40
  const report = JSON.parse(reportJSON);
42
41
  await scorer(report);
43
42
  report.scoreProcID = scoreProcID;
44
43
  // Write it to a file.
45
44
  const scoredReportJSON = JSON.stringify(report, null, 2);
46
- await fs.writeFile(`${__dirname}/${reportDirScored}/${fileName}`, `${scoredReportJSON}\n`);
45
+ await fs.writeFile(`${reportDirScored}/${fileName}`, `${scoredReportJSON}\n`);
47
46
  console.log(`Report ${fileName.slice(0, -5)} scored and saved`);
48
47
  };
49
48
  return reportFileNames.length;