testilo 43.0.2 → 43.1.1

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/digest.js CHANGED
@@ -31,9 +31,9 @@
31
31
  // ########## FUNCTIONS
32
32
 
33
33
  // Digests the scored reports and returns them, digested.
34
- exports.digest = async (digester, report) => {
34
+ exports.digest = async (digester, report, query = {}) => {
35
35
  // Create a digest.
36
- const digest = await digester(report);
36
+ const digest = await digester(report, query);
37
37
  console.log(`Report ${report.id} digested`);
38
38
  // Return the digest.
39
39
  return digest;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testilo",
3
- "version": "43.0.2",
3
+ "version": "43.1.1",
4
4
  "description": "Prepares Testaro jobs and processes Testaro reports",
5
5
  "main": "call.js",
6
6
  "scripts": {
@@ -0,0 +1,32 @@
1
+ <!DOCTYPE HTML>
2
+ <html lang="en-US">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <meta name="author" content="Testilo">
7
+ <meta name="creator" content="Testilo">
8
+ <meta name="publisher" name="Testilo">
9
+ <meta name="description" content="report of accessibility testing of a web page">
10
+ <meta name="keywords" content="accessibility a11y web testing">
11
+ <title>__title__</title>
12
+ <link rel="icon" href="favicon.ico">
13
+ <link rel="stylesheet" href="style.css">
14
+ </head>
15
+ <body>
16
+ <main>
17
+ <header>
18
+ <h1>__mainHeading__</h1>
19
+ </header>
20
+ <h2>__metadataHeading__</h2>
21
+ <ul>
22
+ <li>Test date: __testDate__</li>
23
+ <li>Page: __pageID__</li>
24
+ <li>Page URL: __pageURL__</li>
25
+ </ul>
26
+ <h2>__dataHeading__</h2>
27
+ <div>
28
+ __data__
29
+ </div>
30
+ </main>
31
+ </body>
32
+ </html>
@@ -0,0 +1,56 @@
1
+ /*
2
+ © 2025 Jonathan Robert Pool. All rights reserved.
3
+ Licensed under the MIT License. See LICENSE file for details.
4
+ */
5
+
6
+ // index: abbreviated issue-oriented digester for scoring procedure tsp.
7
+
8
+ // IMPORTS
9
+
10
+ // Module to keep secrets.
11
+ require('dotenv').config();
12
+ // Module to classify tool rules into issues
13
+ const {issues} = require('../../score/tic');
14
+ // Module to process files.
15
+ const fs = require('fs/promises');
16
+ // Utility module.
17
+ const {tools} = require('../../util');
18
+
19
+ // CONSTANTS
20
+
21
+ // Newline with indentations.
22
+ const innerJoiner = '\n ';
23
+ const outerJoiner = '\n ';
24
+
25
+ // FUNCTIONS
26
+
27
+ // Adds parameters to a query for a digest.
28
+ const populateQuery = async (report, query) => {
29
+ const {score} = report;
30
+ const {details} = score;
31
+ const {issue} = details;
32
+ const issueData = [];
33
+ Object.keys(issue).forEach(issueID => {
34
+ issueData.push([issueID, Object.keys(issue[issueID].tools).map(toolID => tools[toolID])]);
35
+ });
36
+ issueData.sort((a, b) => a[1].length - b[1].length);
37
+ const dataLines = [];
38
+ issueData.forEach(issueDatum => {
39
+ dataLines.push(`<h3>Issue: ${issues[issueDatum[0]]}</h3>`);
40
+ dataLines.push(`<p>Reported by: ${issueDatum[1].join(', ')}</p>`);
41
+ });
42
+ query.data = dataLines.join(outerJoiner);
43
+ };
44
+ // Returns a digested report.
45
+ exports.digester = async (report, query) => {
46
+ // Create a query to replace placeholders.
47
+ await populateQuery(report, query);
48
+ // Get the template.
49
+ let template = await fs.readFile(`${__dirname}/index.html`, 'utf8');
50
+ // Replace its placeholders.
51
+ Object.keys(query).forEach(param => {
52
+ template = template.replace(new RegExp(`__${param}__`, 'g'), query[param]);
53
+ });
54
+ // Return the digest.
55
+ return template;
56
+ };