matcher
A function used in a test assertion, such as toBe or toHaveNoViolations, that checks a value and explains any mismatch.
In more detail
Custom matchers package a common check into one readable line, as in expect(results).toHaveNoViolations(). Jest and Vitest ship built-in matchers and let libraries register more.
Related terms
- jest-axe — A library that runs axe-core in Jest-style tests and adds the toHaveNoViolations matcher.
- unit test — An automated check of one small piece of code, such as a single function, that runs quickly and on its own.
Taught in
- Automated Accessibility Testing: axe-core & Testing Library — Design Systems & Component Engineering