Skip to content
masterclass Buddy

Vitest · Matcher

toMatchObject

toMatchObject checks whether an object contains a matching subset of properties. For arrays, it also requires the same number and order of elements.

Last updated

Syntax

(received: object | array) => Awaitable<void>

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • arrayContaining
  • toEqual
  • toStrictEqual
  • expect

Source: expect | Vitest. Checked 2026-11-03.