testilo 30.1.0 → 31.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
@@ -745,25 +745,25 @@ const {track} = require('testilo/track');
745
745
  const trackerDir = `${process.env.FUNCTIONDIR}/track/ttp99a`;
746
746
  const {tracker} = require(`${trackerDir}/index`);
747
747
  const summaryReport = …;
748
- const [reportID, trackReport] = track(tracker, summaryReport);
748
+ const [reportID, 'main competitors', trackReport] = track(tracker, summaryReport);
749
749
  ```
750
750
 
751
- The `track()` function returns an ID and an HTML tracking report that shows data for all of the results in the summary report. The invoking module can further dispose of the tracking report as needed.
751
+ The `track()` function returns an ID and an HTML tracking report that shows data for all of the results in the summary report and identifies “main competitors” as its subject. The invoking module can further dispose of the tracking report as needed.
752
752
 
753
753
  ##### By a user
754
754
 
755
755
  A user can invoke `track()` in one of these ways:
756
756
 
757
757
  ```javaScript
758
- node call track ttp99a
759
- node call track ttp99a 241016
760
- node call track ttp99a 241016 'ABC Foundation'
758
+ node call track ttp99a 'main competitors'
759
+ node call track ttp99a 'main competitors' 241016
760
+ node call track ttp99a 'main competitors' 241016 'ABC Foundation'
761
761
  ```
762
762
 
763
763
  When a user invokes `track()` in this example, the `call` module:
764
764
  - gets the summary report from the last file in the `summarized` subdirectory of the `REPORTDIR` directory, or if the third argument to `call()` exists the last one whose name begins with `'241016'`.
765
765
  - selects the summarized data for all results in the summary report, or if the fourth argument to `call()` exists from all results whose `target.what` property has the value `'ABC Foundation'`.
766
- - uses tracker `ttp99a` to create a tracking report.
766
+ - uses tracker `ttp99a` to create a tracking report that identifies “main competitors” as its subject.
767
767
  - assigns an ID to the tracking report.
768
768
  - writes the tracking report to the `tracking` subdirectory of the `REPORTDIR` directory, with the ID as the base of its file name.
769
769
 
package/call.js CHANGED
@@ -309,24 +309,24 @@ const callCompare = async (what, compareProcID, selector) => {
309
309
  }
310
310
  };
311
311
  // Fulfills a tracking request.
312
- const callTrack = async (trackerID, selector, targetWhat) => {
312
+ const callTrack = async (trackerID, what, selector, targetWhat) => {
313
313
  // Get the summary report.
314
314
  try {
315
315
  const summaryReport = await getSummaryReport(selector);
316
- // Remove unwanted results from it.
317
- summaryReport.summaries = summaryReport.summaries.filter(
318
- result => targetWhat
319
- ? result.sources
320
- && result.sources.target
321
- && result.sources.target.what === targetWhat
322
- : true
323
- );
316
+ // Remove unwanted results, if any, from it.
317
+ if (targetWhat) {
318
+ summaryReport.summaries = summaryReport.summaries.filter(
319
+ result => result.sources
320
+ && result.sources.target
321
+ && result.sources.target.what === targetWhat
322
+ );
323
+ }
324
324
  // If any results remain:
325
325
  if (summaryReport.summaries.length) {
326
326
  // Get the tracker.
327
327
  const {tracker} = require(`${functionDir}/track/${trackerID}/index`);
328
328
  // Track the results.
329
- const [reportID, trackingReport] = await track(tracker, summaryReport);
329
+ const [reportID, trackingReport] = await track(tracker, what, summaryReport);
330
330
  // Save the tracking report.
331
331
  await fs.mkdir(`${reportDir}/tracking`, {recursive: true});
332
332
  const reportPath = `${reportDir}/tracking/${reportID}.html`;
@@ -429,14 +429,14 @@ else if (fn === 'compare' && fnArgs.length === 3) {
429
429
  console.log('Execution completed');
430
430
  });
431
431
  }
432
- else if (fn === 'credit' && fnArgs.length > 0 && fnArgs.length < 3) {
433
- callCredit(... fnArgs)
432
+ else if (fn === 'track' && fnArgs.length > 2 && fnArgs.length < 6) {
433
+ callTrack(... fnArgs)
434
434
  .then(() => {
435
435
  console.log('Execution completed');
436
436
  });
437
437
  }
438
- else if (fn === 'track' && fnArgs.length > 1 && fnArgs.length < 5) {
439
- callTrack(... fnArgs)
438
+ else if (fn === 'credit' && fnArgs.length > 0 && fnArgs.length < 3) {
439
+ callCredit(... fnArgs)
440
440
  .then(() => {
441
441
  console.log('Execution completed');
442
442
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testilo",
3
- "version": "30.1.0",
3
+ "version": "31.0.0",
4
4
  "description": "Prepares and processes Testaro reports",
5
5
  "main": "call.js",
6
6
  "scripts": {
@@ -18,7 +18,7 @@
18
18
  <h1>Accessibility tracking report</h1>
19
19
  </header>
20
20
  <h2>Introduction</h2>
21
- <p>This is tracking report <code>__id__</code>.</p>
21
+ <p>This is tracking report <code>__id__</code>, for __what__.</p>
22
22
  <p>It tracks accessibility scores over time. A perfect score is 0. The tracking was performed by Testilo procedure <code>__tp__</code>.</p>
23
23
  <p>The results are presented first as a graph, and then as a table.</p>
24
24
  <h2>Results as a graph</h2>
@@ -67,7 +67,6 @@
67
67
  <tr>
68
68
  <th>Date and time</th>
69
69
  <th>Score</th>
70
- <th>Order</th>
71
70
  <th>Target</th>
72
71
  </tr>
73
72
  </thead>
@@ -21,9 +21,10 @@ const digestURL = process.env.DIGEST_URL;
21
21
  // FUNCTIONS
22
22
 
23
23
  // Adds parameters to a query for a tracking report.
24
- const populateQuery = async (id, summaryReport, query) => {
24
+ const populateQuery = async (id, what, summaryReport, query) => {
25
25
  // General parameters.
26
26
  query.id = id;
27
+ query.what = what;
27
28
  query.tp = trackerID;
28
29
  query.dateISO = getNowDate();
29
30
  query.dateSlash = getNowDateSlash();
@@ -41,12 +42,11 @@ const populateQuery = async (id, summaryReport, query) => {
41
42
  const timeCell = `<td>${result.endTime}</td>`;
42
43
  const digestLinkDestination = digestURL.replace('__id__', result.id);
43
44
  const scoreCell = `<td><a href=${digestLinkDestination}>${result.score}</a></td>`;
44
- const orderCell = `<td class="center">${result.order}</td>`;
45
45
  const {target} = result.sources;
46
46
  const targetID = alphaNumOf(targetWhats.indexOf(target.what));
47
47
  const targetLink = `<a href="${target.which}">${target.what}</a>`;
48
48
  const targetCell = `<td>${targetID}: ${targetLink}</td>`;
49
- const row = `<tr>${[timeCell, scoreCell, orderCell, targetCell].join('')}</tr>`;
49
+ const row = `<tr>${[timeCell, scoreCell, targetCell].join('')}</tr>`;
50
50
  // Add the row to the array of rows.
51
51
  rows.push(row);
52
52
  });
@@ -54,10 +54,10 @@ const populateQuery = async (id, summaryReport, query) => {
54
54
  query.scoreRows = rows.join(innerJoiner);
55
55
  };
56
56
  // Returns a tracking report.
57
- exports.tracker = async (id, summaryReport) => {
57
+ exports.tracker = async (id, what, summaryReport) => {
58
58
  // Create a query to replace placeholders.
59
59
  const query = {};
60
- await populateQuery(id, summaryReport, query);
60
+ await populateQuery(id, what, summaryReport, query);
61
61
  // Get the template.
62
62
  let template = await fs.readFile(`${__dirname}/index.html`, 'utf8');
63
63
  // Replace its placeholders.
package/track.js CHANGED
@@ -14,9 +14,9 @@ const {getFileID} = require('./procs/util');
14
14
  // ########## FUNCTIONS
15
15
 
16
16
  // Creates and returns a tracking report from a summary.
17
- exports.track = async (tracker, summaryReport) => {
17
+ exports.track = async (tracker, what, summaryReport) => {
18
18
  // Use the tracker to create a tracking report.
19
19
  const id = getFileID(2);
20
- const trackingReport = await tracker(id, summaryReport);
20
+ const trackingReport = await tracker(id, what, summaryReport);
21
21
  return [id, trackingReport];
22
22
  };