@diegovelasquezweb/a11y-engine 0.7.0 → 0.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegovelasquezweb/a11y-engine",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "WCAG 2.2 accessibility audit engine — scanner, analyzer, and report builders",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1184,6 +1184,10 @@ async function _runDomScannerInternal(args) {
1184
1184
 
1185
1185
  writeProgress("page", "running");
1186
1186
 
1187
+ // Track which steps have already emitted "done" so multi-route scans
1188
+ // don't reset progress back to "running" for routes after the first.
1189
+ const emittedDone = new Set();
1190
+
1187
1191
  for (let i = 0; i < routes.length; i += tabPages.length) {
1188
1192
  const batch = [];
1189
1193
  for (let j = 0; j < tabPages.length && i + j < routes.length; j++) {
@@ -1195,7 +1199,10 @@ async function _runDomScannerInternal(args) {
1195
1199
  log.info(`[${idx + 1}/${total}] Scanning: ${routePath}`);
1196
1200
  const targetUrl = new URL(routePath, baseUrl).toString();
1197
1201
 
1198
- writeProgress("page", "done");
1202
+ if (!emittedDone.has("page")) {
1203
+ writeProgress("page", "done");
1204
+ emittedDone.add("page");
1205
+ }
1199
1206
 
1200
1207
  let result = { url: targetUrl, violations: [], incomplete: [], passes: [], metadata: {} };
1201
1208
  let cdpViolations = [];
@@ -1203,7 +1210,7 @@ async function _runDomScannerInternal(args) {
1203
1210
 
1204
1211
  // Step 1: axe-core (conditional)
1205
1212
  if (args.engines.axe) {
1206
- writeProgress("axe", "running");
1213
+ if (!emittedDone.has("axe")) writeProgress("axe", "running");
1207
1214
  result = await analyzeRoute(
1208
1215
  tabPage,
1209
1216
  targetUrl,
@@ -1216,7 +1223,10 @@ async function _runDomScannerInternal(args) {
1216
1223
  args.axeTags,
1217
1224
  );
1218
1225
  const axeViolationCount = result.violations?.length || 0;
1219
- writeProgress("axe", "done", { found: axeViolationCount });
1226
+ if (!emittedDone.has("axe")) {
1227
+ writeProgress("axe", "done", { found: axeViolationCount });
1228
+ emittedDone.add("axe");
1229
+ }
1220
1230
  log.info(`axe-core: ${axeViolationCount} violation(s) found`);
1221
1231
  } else {
1222
1232
  // Navigate for CDP/pa11y even if axe is off
@@ -1228,9 +1238,12 @@ async function _runDomScannerInternal(args) {
1228
1238
 
1229
1239
  // Step 2: CDP checks (conditional)
1230
1240
  if (args.engines.cdp) {
1231
- writeProgress("cdp", "running");
1241
+ if (!emittedDone.has("cdp")) writeProgress("cdp", "running");
1232
1242
  cdpViolations = await runCdpChecks(tabPage);
1233
- writeProgress("cdp", "done", { found: cdpViolations.length });
1243
+ if (!emittedDone.has("cdp")) {
1244
+ writeProgress("cdp", "done", { found: cdpViolations.length });
1245
+ emittedDone.add("cdp");
1246
+ }
1234
1247
  log.info(`CDP checks: ${cdpViolations.length} issue(s) found`);
1235
1248
  } else {
1236
1249
  log.info("CDP checks: skipped (disabled)");
@@ -1238,9 +1251,12 @@ async function _runDomScannerInternal(args) {
1238
1251
 
1239
1252
  // Step 3: pa11y (conditional)
1240
1253
  if (args.engines.pa11y) {
1241
- writeProgress("pa11y", "running");
1254
+ if (!emittedDone.has("pa11y")) writeProgress("pa11y", "running");
1242
1255
  pa11yViolations = await runPa11yChecks(targetUrl, args.axeTags);
1243
- writeProgress("pa11y", "done", { found: pa11yViolations.length });
1256
+ if (!emittedDone.has("pa11y")) {
1257
+ writeProgress("pa11y", "done", { found: pa11yViolations.length });
1258
+ emittedDone.add("pa11y");
1259
+ }
1244
1260
  log.info(`pa11y: ${pa11yViolations.length} issue(s) found`);
1245
1261
  } else {
1246
1262
  log.info("pa11y: skipped (disabled)");
@@ -1248,18 +1264,21 @@ async function _runDomScannerInternal(args) {
1248
1264
 
1249
1265
  // Step 4: Merge results
1250
1266
  const axeViolationCount = result.violations?.length || 0;
1251
- writeProgress("merge", "running");
1267
+ if (!emittedDone.has("merge")) writeProgress("merge", "running");
1252
1268
  const mergedViolations = mergeViolations(
1253
1269
  result.violations || [],
1254
1270
  cdpViolations,
1255
1271
  pa11yViolations,
1256
1272
  );
1257
- writeProgress("merge", "done", {
1258
- axe: axeViolationCount,
1259
- cdp: cdpViolations.length,
1260
- pa11y: pa11yViolations.length,
1261
- merged: mergedViolations.length,
1262
- });
1273
+ if (!emittedDone.has("merge")) {
1274
+ writeProgress("merge", "done", {
1275
+ axe: axeViolationCount,
1276
+ cdp: cdpViolations.length,
1277
+ pa11y: pa11yViolations.length,
1278
+ merged: mergedViolations.length,
1279
+ });
1280
+ emittedDone.add("merge");
1281
+ }
1263
1282
  log.info(`Merged: ${mergedViolations.length} total unique violations (axe: ${axeViolationCount}, cdp: ${cdpViolations.length}, pa11y: ${pa11yViolations.length})`);
1264
1283
 
1265
1284
  // Screenshots for merged violations