Skip to content
masterclass Buddy

Vitest · Matcher

toBeOneOf

toBeOneOf checks whether a value matches at least one item in an array or set. It uses the same deep equality as toEqual and supports negation with expect.not.

Last updated

Syntax

expect(actual).toBeOneOf(sample)

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

Subscribe
  • expect.not
  • toEqual
  • expect.any

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