Skip to content

Commit ec64d2e

Browse files
committed
Improved error message if results are unexpected
When adding a different reporter to `configureAxe` it created an error for this library. While the library shouldn't support different reporters we should warn the user when they do.
1 parent 5bc8fd2 commit ec64d2e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ function filterViolations(violations, impactLevels) {
123123
const toHaveNoViolations = {
124124
toHaveNoViolations(results) {
125125
if (typeof results.violations === "undefined") {
126-
throw new Error("No violations found in aXe results object");
126+
throw new Error(
127+
"Unexpected aXe results object. No violations property found.\nDid you change the `reporter` in your aXe configuration?"
128+
);
127129
}
128130

129131
const violations = filterViolations(

0 commit comments

Comments
 (0)