testaro 58.0.9 → 58.1.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/AGENTS.md +27 -0
- package/LICENSE +2 -1
- package/package.json +1 -1
- package/run.js +23 -7
package/AGENTS.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed under the MIT License. See LICENSE file for details.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
# Testaro Agent Guidelines
|
|
6
|
+
|
|
7
|
+
## Commands
|
|
8
|
+
- **Run all tests**: `npm run tests`
|
|
9
|
+
- **Run single test**: `npm test <testname>` (e.g., `npm test hover`)
|
|
10
|
+
- **Run job**: `npm run run [jobID]`
|
|
11
|
+
- **Directory watch**: `npm run dirWatch`
|
|
12
|
+
- **Network watch**: `npm run netWatch`
|
|
13
|
+
- **Lint**: `npx eslint <file>` (follows `.eslintrc.json`)
|
|
14
|
+
|
|
15
|
+
## Architecture
|
|
16
|
+
- **Main dirs**: `/tests` (tool test definitions), `/procs` (shared procedures), `/validation` (test validators), root (core modules)
|
|
17
|
+
- **Key files**: `run.js` (main executor), `actSpecs.js` (act specifications), `call.js` (CLI entry), `tests/testaro.js` (Testaro tool rules)
|
|
18
|
+
- **Tools**: Integrates 11 a11y tools (Axe, Alfa, IBM Checker, QualWeb, ASLint, WAVE, WallyAX, Ed11y, HTML CodeSniffer, Nu Validator, Testaro)
|
|
19
|
+
- **Data flow**: Jobs (JSON) → run.js → tool tests → reports (with standardized results)
|
|
20
|
+
- **Env vars**: Required for WallyAX (`WAX_KEY`), WAVE (`WAVE_KEY`); optional `DEBUG`, `WAITS`, `JOBDIR`, `REPORTDIR`, `AGENT`
|
|
21
|
+
|
|
22
|
+
## Code Style
|
|
23
|
+
- **ESLint**: 2-space indent, single quotes, semicolons required, Stroustrup brace style, no use-before-define
|
|
24
|
+
- **Imports**: CommonJS (`require`/`module.exports`), not ES modules
|
|
25
|
+
- **Naming**: camelCase for vars/functions, descriptive names, rule IDs in lowercase
|
|
26
|
+
- **Error handling**: Try-catch blocks, report failures via `prevented: true` in results
|
|
27
|
+
- **Comments**: Explain complex logic, but keep concise
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
© 2021–
|
|
3
|
+
© 2021–2025 CVS Health and/or one of its affiliates. All rights reserved.
|
|
4
|
+
© 2025 Jonathan Robert Pool. All rights reserved.
|
|
4
5
|
|
|
5
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
7
|
of this software and associated documentation files (the "Software"), to deal
|
package/package.json
CHANGED
package/run.js
CHANGED
|
@@ -569,26 +569,42 @@ const abortActs = (report, actIndex) => {
|
|
|
569
569
|
console.log(`ERROR: Job aborted on act ${actIndex}`);
|
|
570
570
|
};
|
|
571
571
|
// Performs the acts in a report and adds the results to the report.
|
|
572
|
-
const doActs = async (report) => {
|
|
572
|
+
const doActs = async (report, opts = {}) => {
|
|
573
573
|
const {acts} = report;
|
|
574
|
+
const {onProgress = null, signal = null} = opts;
|
|
574
575
|
// Get the standardization specification.
|
|
575
576
|
const standard = report.standard || 'only';
|
|
576
577
|
const reportPath = `${tmpDir}/report.json`;
|
|
577
578
|
// For each act in the report.
|
|
578
579
|
for (const doActsIndex in acts) {
|
|
580
|
+
if (signal && signal.aborted) throw new Error('doActs aborted');
|
|
579
581
|
actIndex = doActsIndex;
|
|
580
582
|
// If the job has not been aborted:
|
|
581
583
|
if (report.jobData && ! report.jobData.aborted) {
|
|
582
584
|
let act = acts[actIndex];
|
|
583
585
|
const {type, which} = act;
|
|
584
|
-
const actSuffix = type === 'test' ? ` ${which}` : '';
|
|
585
|
-
const message = `>>>> ${type}${actSuffix}`;
|
|
586
586
|
// If granular reporting has been specified:
|
|
587
587
|
if (report.observe) {
|
|
588
|
-
//
|
|
588
|
+
// If a progress callback has been provided:
|
|
589
589
|
const whichParam = which ? `&which=${which}` : '';
|
|
590
590
|
const messageParams = `act=${type}${whichParam}`;
|
|
591
|
-
|
|
591
|
+
if (onProgress) {
|
|
592
|
+
// Notify the observer of the act.
|
|
593
|
+
try {
|
|
594
|
+
onProgress({
|
|
595
|
+
type,
|
|
596
|
+
which
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
catch (error) {}
|
|
600
|
+
}
|
|
601
|
+
// Otherwise, i.e. if no progress callback has been provided:
|
|
602
|
+
else {
|
|
603
|
+
const actSuffix = type === 'test' ? ` ${which}` : '';
|
|
604
|
+
const message = `>>>> ${type}${actSuffix}`;
|
|
605
|
+
// Notify the observer of the act and log it.
|
|
606
|
+
tellServer(report, messageParams, message);
|
|
607
|
+
}
|
|
592
608
|
}
|
|
593
609
|
// Otherwise, i.e. if granular reporting has not been specified:
|
|
594
610
|
else {
|
|
@@ -1386,7 +1402,7 @@ const doActs = async (report) => {
|
|
|
1386
1402
|
return report;
|
|
1387
1403
|
};
|
|
1388
1404
|
// Runs a job and returns a report.
|
|
1389
|
-
exports.doJob = async job => {
|
|
1405
|
+
exports.doJob = async (job, opts = {}) => {
|
|
1390
1406
|
// Make a report as a copy of the job.
|
|
1391
1407
|
let report = JSON.parse(JSON.stringify(job));
|
|
1392
1408
|
const jobData = report.jobData = {};
|
|
@@ -1428,7 +1444,7 @@ exports.doJob = async job => {
|
|
|
1428
1444
|
});
|
|
1429
1445
|
// Perform the acts and get a report.
|
|
1430
1446
|
console.log('Performing the job acts');
|
|
1431
|
-
report = await doActs(report,
|
|
1447
|
+
report = await doActs(report, opts);
|
|
1432
1448
|
// Add the end time and duration to the report.
|
|
1433
1449
|
const endTime = new Date();
|
|
1434
1450
|
report.jobData.endTime = nowString();
|