diff --git a/__tests__/index.test.js b/__tests__/index.test.js index 4a0f5ed..d21a291 100644 --- a/__tests__/index.test.js +++ b/__tests__/index.test.js @@ -218,7 +218,9 @@ describe("jest-axe", () => { const matcherFunction = toHaveNoViolations.toHaveNoViolations; expect(() => { matcherFunction({}); - }).toThrow("No violations found in aXe results object"); + }).toThrow( + "Unexpected aXe results object. No violations property found.\nDid you change the `reporter` in your aXe configuration?" + ); }); it("returns pass as true when no violations are present", () => { diff --git a/index.js b/index.js index 9ac90df..4e0aa7a 100644 --- a/index.js +++ b/index.js @@ -123,7 +123,9 @@ function filterViolations(violations, impactLevels) { const toHaveNoViolations = { toHaveNoViolations(results) { if (typeof results.violations === "undefined") { - throw new Error("No violations found in aXe results object"); + throw new Error( + "Unexpected aXe results object. No violations property found.\nDid you change the `reporter` in your aXe configuration?" + ); } const violations = filterViolations(