@diegovelasquezweb/a11y-engine 0.11.1 → 0.11.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
|
@@ -961,7 +961,7 @@ async function runCdpChecks(page) {
|
|
|
961
961
|
* The browser is NOT closed by this function — the caller is responsible for lifecycle.
|
|
962
962
|
* @returns {Promise<Object[]>} Array of pa11y-sourced violations in axe-compatible format.
|
|
963
963
|
*/
|
|
964
|
-
async function runPa11yChecks(routeUrl, axeTags, sharedBrowser = null) {
|
|
964
|
+
async function runPa11yChecks(routeUrl, axeTags, sharedBrowser = null, includeWarnings = false) {
|
|
965
965
|
const violations = [];
|
|
966
966
|
const equivalenceMap = PA11Y_CONFIG.equivalenceMap || {};
|
|
967
967
|
const impactMap = {};
|
|
@@ -985,6 +985,8 @@ async function runPa11yChecks(routeUrl, axeTags, sharedBrowser = null) {
|
|
|
985
985
|
timeout: 30000,
|
|
986
986
|
wait: 2000,
|
|
987
987
|
ignore: ignoreList,
|
|
988
|
+
includeWarnings: Boolean(includeWarnings),
|
|
989
|
+
includeNotices: false,
|
|
988
990
|
};
|
|
989
991
|
|
|
990
992
|
if (sharedBrowser) {
|
|
@@ -1126,6 +1128,8 @@ function mergeViolations(axeViolations, cdpViolations, pa11yViolations) {
|
|
|
1126
1128
|
/**
|
|
1127
1129
|
* Runs the DOM scanner programmatically.
|
|
1128
1130
|
* @param {Object} options - Scanner configuration (same shape as CLI args object).
|
|
1131
|
+
* @param {boolean} [options.includeWarnings] - Include pa11y WARNING-level issues (default: false). Automatically enabled when includeIncomplete is true.
|
|
1132
|
+
* @param {boolean} [options.includeIncomplete] - Include axe incomplete findings and activates includeWarnings (default: false).
|
|
1129
1133
|
* @param {{ onProgress?: (step: string, status: string, extra?: object) => void }} [callbacks={}]
|
|
1130
1134
|
* @returns {Promise<Object>} The scan payload { generated_at, base_url, onlyRule, projectContext, routes }.
|
|
1131
1135
|
*/
|
|
@@ -1153,6 +1157,7 @@ export async function runDomScanner(options = {}, callbacks = {}) {
|
|
|
1153
1157
|
cdp: options.engines?.cdp !== false,
|
|
1154
1158
|
pa11y: options.engines?.pa11y !== false,
|
|
1155
1159
|
},
|
|
1160
|
+
includeWarnings: options.includeWarnings ?? options.includeIncomplete ?? false,
|
|
1156
1161
|
clearCache: options.clearCache ?? false,
|
|
1157
1162
|
serverMode: options.serverMode ?? false,
|
|
1158
1163
|
};
|
|
@@ -1409,7 +1414,7 @@ async function _runDomScannerInternal(args) {
|
|
|
1409
1414
|
let pa11yPromise = Promise.resolve([]);
|
|
1410
1415
|
if (args.engines.pa11y) {
|
|
1411
1416
|
if (!emittedDone.has("pa11y")) writeProgress("pa11y", "running");
|
|
1412
|
-
pa11yPromise = runPa11yChecks(targetUrl, args.axeTags, pa11yBrowser)
|
|
1417
|
+
pa11yPromise = runPa11yChecks(targetUrl, args.axeTags, pa11yBrowser, args.includeWarnings)
|
|
1413
1418
|
.then((violations) => {
|
|
1414
1419
|
if (!emittedDone.has("pa11y")) {
|
|
1415
1420
|
writeProgress("pa11y", "done", { found: violations.length });
|