axe-playwright 1.2.1 → 1.2.3
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/README.md +3 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -120,7 +120,9 @@ The `verbose` key is a boolean to whether to print the message `No accessibility
|
|
|
120
120
|
|
|
121
121
|
##### reporter (optional)
|
|
122
122
|
|
|
123
|
-
A class instance that implements the `Reporter` interface or values `default` and `
|
|
123
|
+
A class instance that implements the `Reporter` interface or values `default`, `v2` and `html`. Custom reporter instances can be supplied to override default reporting behaviour dictated by `DefaultTerminalReporter` set by the value `default`. `v2` is the new TerminalReporter inspired by the reports from [jest-axe](https://github.com/nickcolley/jest-axe). `html` reporter will generate external HTML file.
|
|
124
|
+
|
|
125
|
+
Note! `html` reporter will disable printed to logs violations.
|
|
124
126
|
|
|
125
127
|
##### skipFailures (optional, defaults to false)
|
|
126
128
|
|
package/dist/index.d.ts
CHANGED
|
@@ -52,5 +52,5 @@ export declare const reportViolations: (violations: Result[], reporter: Reporter
|
|
|
52
52
|
* @param reporter
|
|
53
53
|
* @param options
|
|
54
54
|
*/
|
|
55
|
-
export declare const checkA11y: (page: Page, context?: ElementContext | undefined, axeOptions?: AxeOptions | undefined, skipFailures?: boolean, reporter?: Reporter | 'default' | 'v2', options?: Options | undefined) => Promise<void>;
|
|
55
|
+
export declare const checkA11y: (page: Page, context?: ElementContext | undefined, axeOptions?: AxeOptions | undefined, skipFailures?: boolean, reporter?: Reporter | 'default' | 'html' | 'v2', options?: Options | undefined) => Promise<void>;
|
|
56
56
|
export { DefaultTerminalReporter };
|
package/dist/index.js
CHANGED
|
@@ -105,11 +105,6 @@ exports.reportViolations = reportViolations;
|
|
|
105
105
|
const checkA11y = (page, context = undefined, axeOptions = undefined, skipFailures = false, reporter = 'default', options = undefined) => __awaiter(void 0, void 0, void 0, function* () {
|
|
106
106
|
var _a, _b, _c;
|
|
107
107
|
const violations = yield (0, exports.getViolations)(page, context, axeOptions === null || axeOptions === void 0 ? void 0 : axeOptions.axeOptions);
|
|
108
|
-
if (violations.length > 0) {
|
|
109
|
-
yield (0, axe_html_reporter_1.createHtmlReport)({ results: { violations }, options });
|
|
110
|
-
}
|
|
111
|
-
else
|
|
112
|
-
console.log("There were no violations to save in report");
|
|
113
108
|
const impactedViolations = (0, utils_1.getImpactedViolations)(violations, axeOptions === null || axeOptions === void 0 ? void 0 : axeOptions.includedImpacts);
|
|
114
109
|
let reporterWithOptions;
|
|
115
110
|
if (reporter === 'default') {
|
|
@@ -118,11 +113,19 @@ const checkA11y = (page, context = undefined, axeOptions = undefined, skipFailur
|
|
|
118
113
|
else if (reporter === 'v2') {
|
|
119
114
|
reporterWithOptions = new terminalReporterV2_1.default((_c = axeOptions === null || axeOptions === void 0 ? void 0 : axeOptions.verbose) !== null && _c !== void 0 ? _c : false);
|
|
120
115
|
}
|
|
116
|
+
else if (reporter === 'html') {
|
|
117
|
+
if (violations.length > 0) {
|
|
118
|
+
yield (0, axe_html_reporter_1.createHtmlReport)({ results: { violations }, options });
|
|
119
|
+
}
|
|
120
|
+
else
|
|
121
|
+
console.log("There were no violations to save in report");
|
|
122
|
+
}
|
|
121
123
|
else {
|
|
122
124
|
reporterWithOptions = reporter;
|
|
123
125
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
if (reporter !== 'html')
|
|
127
|
+
yield (0, exports.reportViolations)(impactedViolations, reporterWithOptions);
|
|
128
|
+
if (reporter === 'v2' || reporter !== 'html')
|
|
126
129
|
(0, utils_1.testResultDependsOnViolations)(impactedViolations, skipFailures);
|
|
127
130
|
});
|
|
128
131
|
exports.checkA11y = checkA11y;
|