testaro 30.0.1 → 30.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "30.0.1",
3
+ "version": "30.0.2",
4
4
  "description": "Run 960 web accessibility tests from 9 tools and get a standardized report",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -17,13 +17,13 @@ exports.tellServer = (report, messageParams, logMessage) => {
17
17
  const whoParams = `agent=${agent}&jobID=${report.id || ''}`;
18
18
  const wholeURL = `${observer}?${whoParams}&${messageParams}`;
19
19
  const client = wholeURL.startsWith('https://') ? httpsClient : httpClient;
20
- const request = client.request(wholeURL);
20
+ client.request(wholeURL)
21
21
  // If the notification threw an error:
22
- request.on('error', error => {
22
+ .on('error', error => {
23
23
  // Report the error.
24
24
  const errorMessage = 'ERROR notifying the server';
25
25
  console.log(`${errorMessage} (${error.message})`);
26
- });
27
- request.end();
26
+ })
27
+ .end();
28
28
  console.log(`${logMessage} (server notified)`);
29
29
  };
package/tests/testaro.js CHANGED
@@ -99,6 +99,14 @@ const jsonTest = async (ruleID, ruleArgs) => {
99
99
  withItems, all, ruleObj.ruleID, whats, ruleObj.ordinalSeverity, ruleObj.summaryTagName
100
100
  );
101
101
  };
102
+ // Waits.
103
+ const wait = ms => {
104
+ return new Promise(resolve => {
105
+ setTimeout(() => {
106
+ resolve('');
107
+ }, ms);
108
+ });
109
+ };
102
110
  // Conducts and reports Testaro tests.
103
111
  exports.reporter = async (page, options) => {
104
112
  const {withItems, stopOnFail, granular, args} = options;
@@ -119,6 +127,8 @@ exports.reporter = async (page, options) => {
119
127
  && ['y', 'n'].includes(rules[0])
120
128
  && rules.slice(1).every(rule => evalRules[rule] || etcRules[rule])
121
129
  ) {
130
+ // Wait 1 second to prevent out-of-order logging with granular reporting.
131
+ await wait(1000);
122
132
  // For each rule invoked:
123
133
  const calledRules = rules[0] === 'y'
124
134
  ? rules.slice(1)
package/watch.js CHANGED
@@ -63,6 +63,7 @@ const archiveJob = async (job, isFile) => {
63
63
  // Save the job in the done subdirectory.
64
64
  const {id} = job;
65
65
  const jobJSON = JSON.stringify(job, null, 2);
66
+ await fs.mkdir(`${jobDir}/done`, {recursive: true});
66
67
  await fs.writeFile(`${jobDir}/done/${id}.json`, jobJSON);
67
68
  // If the job had been saved as a file in the todo subdirectory:
68
69
  if (isFile) {