salesforce/sa11y

fix(format): error when expect(elem).not.toBeAccessible is called on an elem with no a11y issues

Closed this issue · 0 comments

For a HTML element that has no a11y issues:
Expected: expect(elem).not.toBeAccessible() to throw a jest exception error
Got:

  TypeError: Cannot read property 'format' of undefined

      at message (../node_modules/@sa11y/jest/dist/matcher.js:57:137)
      at getMessage (../node_modules/expect/build/index.js:177:15)
      at processResult (../node_modules/expect/build/index.js:295:25)
      at asyncResult.then.aResult (../node_modules/expect/build/index.js:353:28)

This should not be a critical issues as the not matcher is not expected to be used with the toBeAccessible matcher in primary workflows.