@sa11y/jest 6.5.0 → 6.6.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"automatic.d.ts","sourceRoot":"","sources":["../src/automatic.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAI7B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAcF,eAAO,MAAM,2BAA2B,aAAc,MAAM,GAAG,IAAI,SAElE,CAAC;AAEF,eAAO,MAAM,2BAA2B,qBAEvC,CAAC;AAEF;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAUtF;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,IAAI,GAAE,aAAoC,GAAG,OAAO,CAAC,IAAI,CAAC,CAkD9F;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,GAAE,aAAoC,GAAG,IAAI,CAQ7F"}
1
+ {"version":3,"file":"automatic.d.ts","sourceRoot":"","sources":["../src/automatic.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAI7B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAcF,eAAO,MAAM,2BAA2B,aAAc,MAAM,GAAG,IAAI,SAElE,CAAC;AAEF,eAAO,MAAM,2BAA2B,qBAEvC,CAAC;AAEF;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAUtF;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,IAAI,GAAE,aAAoC,GAAG,OAAO,CAAC,IAAI,CAAC,CAoD9F;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,GAAE,aAAoC,GAAG,IAAI,CAQ7F"}
package/dist/automatic.js CHANGED
@@ -82,6 +82,9 @@ async function automaticCheck(opts = defaultAutoCheckOpts) {
82
82
  currNode = walker.nextSibling();
83
83
  }
84
84
  }
85
+ catch (e) {
86
+ format_1.AxeError.throwAxeError(e);
87
+ }
85
88
  finally {
86
89
  (0, exports.setOriginalDocumentBodyHtml)(null);
87
90
  document.body.innerHTML = currentDocumentHtml;
@@ -1 +1 @@
1
- {"version":3,"file":"groupViolationResultsProcessor.d.ts","sourceRoot":"","sources":["../src/groupViolationResultsProcessor.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAA+B,MAAM,mBAAmB,CAAC;AAsHlF;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,GAAG,gBAAgB,CAapF"}
1
+ {"version":3,"file":"groupViolationResultsProcessor.d.ts","sourceRoot":"","sources":["../src/groupViolationResultsProcessor.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAA+B,MAAM,mBAAmB,CAAC;AAkIlF;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,GAAG,gBAAgB,CAapF"}
@@ -30,8 +30,10 @@ function createA11yRuleViolation(a11yRule, ruleIndex) {
30
30
  */
31
31
  function processA11yErrors(results, testSuite, testResult) {
32
32
  const a11yFailureDetails = [];
33
+ const axeFailureDetails = [];
33
34
  const a11yFailureMessages = [];
34
- let a11yErrorsExist = false;
35
+ const axeFailureMessages = [];
36
+ let a11yAxeErrorsExist = false;
35
37
  testResult.failureDetails.forEach((failure) => {
36
38
  let error = failure.error;
37
39
  // If using circus test runner https://github.com/facebook/jest/issues/11405#issuecomment-843549606
@@ -40,7 +42,7 @@ function processA11yErrors(results, testSuite, testResult) {
40
42
  if (error === undefined)
41
43
  error = failure;
42
44
  if (error.name === format_1.A11yError.name) {
43
- a11yErrorsExist = true;
45
+ a11yAxeErrorsExist = true;
44
46
  a11yFailureDetails.push({ ...failure });
45
47
  const a11yRuleViolations = {};
46
48
  let a11yRuleViolationsCount = 0;
@@ -79,16 +81,24 @@ function processA11yErrors(results, testSuite, testResult) {
79
81
  `;
80
82
  a11yFailureMessages.push(a11yFailureMessage);
81
83
  }
84
+ if (error.name === format_1.AxeError.name) {
85
+ a11yAxeErrorsExist = true;
86
+ axeFailureDetails.push({ ...failure });
87
+ axeFailureMessages.push(`
88
+ The test has failed to execute the accessibility check.
89
+ Please contact our Sa11y team: http://sfdc.co/sa11y-users
90
+ `);
91
+ }
82
92
  });
83
- if (!a11yErrorsExist) {
93
+ if (!a11yAxeErrorsExist) {
84
94
  testSuite.numFailingTests -= 1;
85
95
  results.numFailedTests -= 1;
86
96
  if (testSuite.numFailingTests === 0)
87
97
  results.numFailedTestSuites -= 1;
88
98
  }
89
- testResult.failureDetails = [...a11yFailureDetails];
90
- testResult.failureMessages = [...a11yFailureMessages];
91
- testResult.status = a11yFailureDetails.length === 0 ? 'passed' : testResult.status;
99
+ testResult.failureDetails = [...a11yFailureDetails, ...axeFailureDetails];
100
+ testResult.failureMessages = [...a11yFailureMessages, ...axeFailureMessages];
101
+ testResult.status = testResult.failureDetails.length === 0 ? 'passed' : testResult.status;
92
102
  }
93
103
  /**
94
104
  * Custom results processor for a11y results grouping the violations. Only affects JSON results file output.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sa11y/jest",
3
- "version": "6.5.0",
3
+ "version": "6.6.0",
4
4
  "description": "Accessibility testing matcher for Jest",
5
5
  "license": "BSD-3-Clause",
6
6
  "homepage": "https://github.com/salesforce/sa11y/tree/master/packages/jest#readme",
@@ -24,9 +24,9 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "@jest/test-result": "^27",
27
- "@sa11y/assert": "6.5.0",
28
- "@sa11y/format": "6.5.0",
29
- "@sa11y/preset-rules": "6.5.0",
27
+ "@sa11y/assert": "6.6.0",
28
+ "@sa11y/format": "6.6.0",
29
+ "@sa11y/preset-rules": "6.6.0",
30
30
  "jest-matcher-utils": "^27"
31
31
  },
32
32
  "peerDependencies": {
@@ -34,8 +34,8 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@jest/globals": "28.1.3",
37
- "@sa11y/common": "6.5.0",
38
- "@sa11y/test-utils": "6.5.0"
37
+ "@sa11y/common": "6.6.0",
38
+ "@sa11y/test-utils": "6.6.0"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"
@@ -43,5 +43,5 @@
43
43
  "engines": {
44
44
  "node": "^16 || ^18"
45
45
  },
46
- "gitHead": "987dfd0ab61b9d197959d0073f3fe02d5130cc89"
46
+ "gitHead": "6ed0d128d07ee67b28d4d8e47b977180bc7fc547"
47
47
  }