testilo 3.2.0 → 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.
package/README.md CHANGED
@@ -56,11 +56,11 @@ When Testilo digests a report, Testilo saves the digest in the directory whose r
56
56
 
57
57
  ### Comparing
58
58
 
59
- You can use Testilo to publish comparisons of accessibility scores. To do this, execute the statement `node compare abc xyz`, replacing `abc` with the prefix of the names of the reports and `xyz` with the name of a subdirectory of the `procs/compare` directory.
59
+ You can use Testilo to publish comparisons of accessibility scores. To do this, execute the statement `node compare abc xyz`, replacing `abc` with a filename base for the comparison and `xyz` with the name of a subdirectory of the `procs/compare` directory.
60
60
 
61
- Testilo will use the comparison proc you name to compile the scores into a table and construct a web page containing that table. It will save the page in the `reports/comparative` directory. The name of the file will be `abc.html`.
61
+ Testilo will examine all of the scored reports in the `REPORTDIR_SCORED` directory. The comparison proc in the `xyz` directory will construct a web page. Testilo will save the page in the `COMPARISONDIR` directory. The name of the file will be `abc.html`.
62
62
 
63
- In the table, the first column will contain descriptions of the pages (the `what` property of the hosts in the batch), such as “Wikipedia English”. Each such description will be a link to the page on the web. The second column will contain the scores of the pages. Each score will be a link to the digest for its page. The link will be `
63
+ Comparison procs can design various pages on the basis of a set of scored reports. As an example, the `cp0` comparison proc creates a page that contains a table of scores, shown both numerically and with a bar graph. In the table, the first column contains descriptions of the pages (the `what` property of the hosts in the batch), such as “Wikipedia English”. Each such description is a link to the page on the web. The second column contains the scores of the pages. Each score is a link to the digest for its page. The link points to a digest located in a `digests` directory adjacent to the page itself. Thus, to use the `cp0` comparison proc, you would copy its output file to a web server, create a `digests` directory on the server as a sibling of that file, and copy the digest files into the `digests` directory.
64
64
 
65
65
  This procedure has some preconditions:
66
66
  - The comparison proc is compatible with the score proc that scored the report.
package/compare.js CHANGED
@@ -13,9 +13,9 @@ const fs = require('fs/promises');
13
13
 
14
14
  // ########## CONSTANTS
15
15
 
16
- const tableDir = process.env.COMPARISONDIR || 'reports/comparative';
17
- const reportTimeStamp = process.argv[2];
18
- const tableProcID = process.argv[3];
16
+ const comparisonDir = process.env.COMPARISONDIR || 'reports/comparative';
17
+ const comparisonNameBase = process.argv[2];
18
+ const compareProcID = process.argv[3];
19
19
 
20
20
  // ########## FUNCTIONS
21
21
 
@@ -24,13 +24,13 @@ const replaceHolders = (content, query) => content
24
24
  .replace(/__([a-zA-Z]+)__/g, (ph, qp) => query[qp]);
25
25
  // Creates and saves a web page containing a comparative table.
26
26
  const compare = async () => {
27
- const tableDirAbs = `${__dirname}/${tableDir}`;
28
- const {getQuery} = require(`./procs/compare/${tableProcID}/index`);
27
+ const comparisonDirAbs = `${__dirname}/${comparisonDir}`;
28
+ const {getQuery} = require(`./procs/compare/${compareProcID}/index`);
29
29
  const query = await getQuery();
30
- const pageRaw = await fs.readFile(`${__dirname}/procs/compare/${tableProcID}/index.html`, 'utf8');
30
+ const pageRaw = await fs.readFile(`${__dirname}/procs/compare/${compareProcID}/index.html`, 'utf8');
31
31
  const page = replaceHolders(pageRaw, query);
32
- await fs.writeFile(`${tableDirAbs}/${reportTimeStamp}.html`, page);
33
- console.log(`Page comparing ${reportTimeStamp} reports created and saved`);
32
+ await fs.writeFile(`${comparisonDirAbs}/${comparisonNameBase}.html`, page);
33
+ console.log(`Page ${comparisonNameBase}.html created and saved`);
34
34
  };
35
35
 
36
36
  // ########## OPERATION
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testilo",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "description": "Client that scores and digests Testaro reports",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -18,11 +18,16 @@
18
18
  <h1>Accessibility score comparison</h1>
19
19
  </header>
20
20
  <h2>Introduction</h2>
21
- <p>The <code>tp10</code> <a href="https://www.w3.org/WAI/fundamentals/accessibility-intro/">accessibility</a> testing procedure was executed by <a href="https://www.npmjs.com/package/testaro">Testaro</a> on __pageCount__ web pages. The procedure performed 808 tests on each page. Of these, 16 tests are custom tests defined by Testaro, and the others belong to packages of tests created by others. Testaro produced reports enumerating the test results.</p>
22
- <p>Given the reports produced by Testaro, another application, <a href="https://www.npmjs.com/package/testilo">Testilo</a>, used its <code>sp10a</code> procedure to assigned weights to the tests and compute a total score for each page (where 0 is the best possible score), adding a section on scoring to each report.</p>
23
- <p>Testilo used a third procedure, <code>dp10a</code>, to create a digest from each report, summarizing the tests and how the score was computed. The report for each page is included, as an appendix, in the page&rsquo;s digest.</p>
24
- <p>Testilo produced this comparison page with a fourth procedure, <code>cp0</code>, listing the tested web pages in order of their scores (best to worst) and showing their scores in a table. The table includes links to the pages and to the digests.</p>
25
- <p>Tests and scoring formulae are fallible and subjective. The reported faults merit investigation as potential opportunities for improved accessibility. But some may not actually harm accessibility, and some other accessibility faults may have escaped detection by any of the tests. Different reasonable procedures could yield different test results and different scores. Both Testaro and Testilo can be customized to fit different definitions and weightings of types of accessibility.</p>
21
+ <p>The table below compares __pageCount__ web pages on <a href="https://www.w3.org/WAI/fundamentals/accessibility-intro/">accessibility</a>. The page names link to the pages on the web. The scores link to digests that explain in detail how the scores were computed.</p>
22
+ <p>The pages were:</p>
23
+ <div id="summary">
24
+ <p>Tested by <a href="https://www.npmjs.com/package/testaro">Testaro</a> with procedure <code>tp10</code></p>
25
+ <p>Scored by <a href="https://www.npmjs.com/package/testilo">Testilo</a> with procedure <code>sp10a</code></p>
26
+ <p>Digested by Testilo with procedure <code>dp10a</code></p>
27
+ <p>Compared by Testilo with procedure <code>cp0</code></p>
28
+ </div>
29
+ <p>The <code>tp10</code> procedure performs 808 tests on each page. Of these, 16 tests are custom tests defined by Testaro, and the others belong to packages of tests created by others.</p>
30
+ <p>Tests and scoring formulae are fallible and subjective. The reported faults merit investigation as potential opportunities for improved accessibility. But some may not actually harm accessibility, and some other accessibility faults may have escaped detection. Different reasonable procedures could yield different test results and different scores. Testaro and Testilo can be customized to fit different definitions and weightings of types of accessibility.</p>
26
31
  <h2>Comparison</h2>
27
32
  <table class="allBorder">
28
33
  <caption>Accessibility scores of web pages</caption>
@@ -13,7 +13,6 @@ const fs = require('fs/promises');
13
13
  // ########## CONSTANTS
14
14
 
15
15
  const reportDirScored = process.env.REPORTDIR_SCORED || 'reports/scored';
16
- const reportIDStart = process.argv[2];
17
16
  const query = {};
18
17
 
19
18
  // ########## FUNCTIONS
@@ -22,8 +21,7 @@ const query = {};
22
21
  const getData = async () => {
23
22
  const reportDirAbs = `${__dirname}/../../../${reportDirScored}`;
24
23
  const reportFileNamesAll = await fs.readdir(reportDirAbs);
25
- const reportFileNamesSource = reportFileNamesAll
26
- .filter(fileName => fileName.startsWith(reportIDStart) && fileName.endsWith('.json'));
24
+ const reportFileNamesSource = reportFileNamesAll.filter(fileName => fileName.endsWith('.json'));
27
25
  const pageCount = reportFileNamesSource.length;
28
26
  const bodyData = [];
29
27
  for (const fileName of reportFileNamesSource) {
@@ -51,7 +49,7 @@ const getTableBody = async bodyData => {
51
49
  .map(item => {
52
50
  const {id, host, score} = item;
53
51
  const pageCell = `<th scope="row"><a href="${host.which}">${host.what}</a></th>`;
54
- const numCell = `<td><a href="reports/${id}.html">${score}</a></td>`;
52
+ const numCell = `<td><a href="digests/${id}.html">${score}</a></td>`;
55
53
  const barWidth = 100 * score / maxScore;
56
54
  const bar = `<rect height="100%" width="${barWidth}%" fill="red"></rect>`;
57
55
  const barCell = `<td aria-hidden="true"><svg width="100%" height="0.7em">${bar}</svg></td>`;
@@ -24,7 +24,7 @@
24
24
  <p>Tested by: Testaro, <code>tp10</code></p>
25
25
  <p>Scored by: Testilo, <code>sp10a</code></p>
26
26
  <p>Digested by: Testilo, <code>dp10a</code></p>
27
- </dl>
27
+ </div>
28
28
  </header>
29
29
  <h2>Introduction</h2>
30
30
  <p>The <code>tp10</code> <a href="https://www.w3.org/WAI/fundamentals/accessibility-intro/">accessibility</a> testing procedure was executed by <a href="https://www.npmjs.com/package/testaro">Testaro</a> on the web page at <a href="__url__">__url__</a>, belonging to __org__, on __dateSlash__. The procedure performed 808 tests. Of these, 16 tests are custom tests defined by Testaro, and the others belong to packages of tests created by others. Testaro produced a report enumerating the test results. The report is appended, below, to this page.</p>
@@ -18,11 +18,16 @@
18
18
  <h1>Accessibility score comparison</h1>
19
19
  </header>
20
20
  <h2>Introduction</h2>
21
- <p>The <code>tp10</code> <a href="https://www.w3.org/WAI/fundamentals/accessibility-intro/">accessibility</a> testing procedure was executed by <a href="https://www.npmjs.com/package/testaro">Testaro</a> on 1 web pages. The procedure performed 808 tests on each page. Of these, 16 tests are custom tests defined by Testaro, and the others belong to packages of tests created by others. Testaro produced reports enumerating the test results.</p>
22
- <p>Given the reports produced by Testaro, another application, <a href="https://www.npmjs.com/package/testilo">Testilo</a>, used its <code>sp10a</code> procedure to assigned weights to the tests and compute a total score for each page (where 0 is the best possible score), adding a section on scoring to each report.</p>
23
- <p>Testilo used a third procedure, <code>dp10a</code>, to create a digest from each report, summarizing the tests and how the score was computed. The report for each page is included, as an appendix, in the page&rsquo;s digest.</p>
24
- <p>Testilo produced this comparison page with a fourth procedure, <code>cp0</code>, listing the tested web pages in order of their scores (best to worst) and showing their scores in a table. The table includes links to the pages and to the digests.</p>
25
- <p>Tests and scoring formulae are fallible and subjective. The reported faults merit investigation as potential opportunities for improved accessibility. But some may not actually harm accessibility, and some other accessibility faults may have escaped detection by any of the tests. Different reasonable procedures could yield different test results and different scores. Both Testaro and Testilo can be customized to fit different definitions and weightings of types of accessibility.</p>
21
+ <p>The table below compares 1 web pages on <a href="https://www.w3.org/WAI/fundamentals/accessibility-intro/">accessibility</a>. The page names link to the pages on the web. The scores link to digests that explain in detail how the scores were computed.</p>
22
+ <p>The pages were:</p>
23
+ <div id="summary">
24
+ <p>Tested by <a href="https://www.npmjs.com/package/testaro">Testaro</a> with procedure <code>tp10</code></p>
25
+ <p>Scored by <a href="https://www.npmjs.com/package/testilo">Testilo</a> with procedure <code>sp10a</code></p>
26
+ <p>Digested by Testilo with procedure <code>dp10a</code></p>
27
+ <p>Compared by Testilo with procedure <code>cp0</code></p>
28
+ </div>
29
+ <p>The <code>tp10</code> procedure performs 808 tests on each page. Of these, 16 tests are custom tests defined by Testaro, and the others belong to packages of tests created by others.</p>
30
+ <p>Tests and scoring formulae are fallible and subjective. The reported faults merit investigation as potential opportunities for improved accessibility. But some may not actually harm accessibility, and some other accessibility faults may have escaped detection. Different reasonable procedures could yield different test results and different scores. Testaro and Testilo can be customized to fit different definitions and weightings of types of accessibility.</p>
26
31
  <h2>Comparison</h2>
27
32
  <table class="allBorder">
28
33
  <caption>Accessibility scores of web pages</caption>
@@ -30,7 +35,7 @@
30
35
  <tr><th scope="col">Page</th><th scope="col" colspan="2">Score (lower is better)</tr>
31
36
  </thead>
32
37
  <tbody class="linkSmaller secondCellRight">
33
- <tr><th scope="row"><a href="https://www.railpass.com/">Railpass</a></th><td><a href="reports/35k1r-railpass.html">1589</a></td><td aria-hidden="true"><svg width="100%" height="0.7em"><rect height="100%" width="100%" fill="red"></rect></svg></td></tr>
38
+ <tr><th scope="row"><a href="https://www.railpass.com/">Railpass</a></th><td><a href="digests/35k1r-railpass.html">1589</a></td><td aria-hidden="true"><svg width="100%" height="0.7em"><rect height="100%" width="100%" fill="red"></rect></svg></td></tr>
34
39
  </tbody>
35
40
  </table>
36
41
  <footer>
@@ -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
  }
@@ -24,7 +24,7 @@
24
24
  <p>Tested by: Testaro, <code>tp10</code></p>
25
25
  <p>Scored by: Testilo, <code>sp10a</code></p>
26
26
  <p>Digested by: Testilo, <code>dp10a</code></p>
27
- </dl>
27
+ </div>
28
28
  </header>
29
29
  <h2>Introduction</h2>
30
30
  <p>The <code>tp10</code> <a href="https://www.w3.org/WAI/fundamentals/accessibility-intro/">accessibility</a> testing procedure was executed by <a href="https://www.npmjs.com/package/testaro">Testaro</a> on the web page at <a href="https://www.railpass.com/">https://www.railpass.com/</a>, belonging to Railpass, on 2022/06/03. The procedure performed 808 tests. Of these, 16 tests are custom tests defined by Testaro, and the others belong to packages of tests created by others. Testaro produced a report enumerating the test results. The report is appended, below, to this page.</p>