@sa11y/common
Advanced tools
Comparing version 6.10.3 to 6.11.0
import * as axe from 'axe-core'; | ||
import { RuleMetadata } from 'axe-core'; | ||
import { resultGroups, RuleMetadata } from 'axe-core'; | ||
export declare const axeRuntimeExceptionMsgPrefix = "Error running accessibility checks using axe:"; | ||
export declare const axeVersion: string | undefined; | ||
export type AxeResults = axe.Result[]; | ||
export type AxeResults = axe.Result[] | axeIncompleteResults[]; | ||
/** | ||
@@ -12,2 +12,5 @@ * Interface that represents a function that runs axe and returns violations | ||
} | ||
export interface axeIncompleteResults extends axe.Result { | ||
message?: string; | ||
} | ||
/** | ||
@@ -21,5 +24,15 @@ * A11yConfig defines options to run accessibility checks using axe specifying list of rules to test | ||
}; | ||
resultTypes: ['violations']; | ||
resultTypes: resultGroups[]; | ||
} | ||
/** | ||
* Get results by running axe with given function | ||
* @param axeRunner - function satisfying AxeRunner interface | ||
*/ | ||
export declare function getA11yResults(axeRunner: AxeRunner): Promise<AxeResults>; | ||
/** | ||
* Get incomplete by running axe with given function | ||
* @param axeRunner - function satisfying AxeRunner interface | ||
*/ | ||
export declare function getIncomplete(axeRunner: AxeRunner): Promise<AxeResults>; | ||
/** | ||
* Get violations by running axe with given function | ||
@@ -26,0 +39,0 @@ * @param axeRunner - function satisfying AxeRunner interface |
@@ -32,3 +32,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getAxeRules = exports.getViolations = exports.axeVersion = exports.axeRuntimeExceptionMsgPrefix = void 0; | ||
exports.getAxeRules = exports.getViolations = exports.getIncomplete = exports.getA11yResults = exports.axeVersion = exports.axeRuntimeExceptionMsgPrefix = void 0; | ||
const axe = __importStar(require("axe-core")); | ||
@@ -38,9 +38,9 @@ exports.axeRuntimeExceptionMsgPrefix = 'Error running accessibility checks using axe:'; | ||
/** | ||
* Get violations by running axe with given function | ||
* Get results by running axe with given function | ||
* @param axeRunner - function satisfying AxeRunner interface | ||
*/ | ||
async function getViolations(axeRunner) { | ||
let violations; | ||
async function getA11yResults(axeRunner) { | ||
let results; | ||
try { | ||
violations = await axeRunner(); | ||
results = await axeRunner(); | ||
} | ||
@@ -50,4 +50,20 @@ catch (e) { | ||
} | ||
return violations; | ||
return results; | ||
} | ||
exports.getA11yResults = getA11yResults; | ||
/** | ||
* Get incomplete by running axe with given function | ||
* @param axeRunner - function satisfying AxeRunner interface | ||
*/ | ||
async function getIncomplete(axeRunner) { | ||
return getA11yResults(axeRunner); | ||
} | ||
exports.getIncomplete = getIncomplete; | ||
/** | ||
* Get violations by running axe with given function | ||
* @param axeRunner - function satisfying AxeRunner interface | ||
*/ | ||
async function getViolations(axeRunner) { | ||
return getA11yResults(axeRunner); | ||
} | ||
exports.getViolations = getViolations; | ||
@@ -54,0 +70,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
export { A11yConfig, AxeResults, axeRuntimeExceptionMsgPrefix, axeVersion, getAxeRules, getViolations } from './axe'; | ||
export { A11yConfig, AxeResults, axeIncompleteResults, axeRuntimeExceptionMsgPrefix, axeVersion, getAxeRules, getViolations, getIncomplete, } from './axe'; | ||
export { WdioAssertFunction, WdioOptions } from './wdio'; | ||
@@ -3,0 +3,0 @@ export { errMsgHeader, ExceptionList } from './format'; |
@@ -9,3 +9,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.registerCustomRules = exports.processFiles = exports.useCustomRules = exports.useFilesToBeExempted = exports.log = exports.errMsgHeader = exports.getViolations = exports.getAxeRules = exports.axeVersion = exports.axeRuntimeExceptionMsgPrefix = void 0; | ||
exports.registerCustomRules = exports.processFiles = exports.useCustomRules = exports.useFilesToBeExempted = exports.log = exports.errMsgHeader = exports.getIncomplete = exports.getViolations = exports.getAxeRules = exports.axeVersion = exports.axeRuntimeExceptionMsgPrefix = void 0; | ||
var axe_1 = require("./axe"); | ||
@@ -16,2 +16,3 @@ Object.defineProperty(exports, "axeRuntimeExceptionMsgPrefix", { enumerable: true, get: function () { return axe_1.axeRuntimeExceptionMsgPrefix; } }); | ||
Object.defineProperty(exports, "getViolations", { enumerable: true, get: function () { return axe_1.getViolations; } }); | ||
Object.defineProperty(exports, "getIncomplete", { enumerable: true, get: function () { return axe_1.getIncomplete; } }); | ||
var format_1 = require("./format"); | ||
@@ -18,0 +19,0 @@ Object.defineProperty(exports, "errMsgHeader", { enumerable: true, get: function () { return format_1.errMsgHeader; } }); |
{ | ||
"name": "@sa11y/common", | ||
"version": "6.10.3", | ||
"version": "6.11.0", | ||
"description": "Common utilities, constants, error messages for @sa11y", | ||
@@ -30,3 +30,3 @@ "license": "BSD-3-Clause", | ||
}, | ||
"gitHead": "b4c71b08193d392555584d51481c38e37dcf85ad" | ||
"gitHead": "2fe695a0b593b37e4f126e586348c1b5ce0bd624" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19823
311