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

Taught in

References