Skip to content
masterclass Buddy

Vitest · Module

soft

Vitest's expect creates assertions about values and behavior. It also supports soft assertions, polling, snapshots, and checks for calls on spies.

Last updated

Syntax

expect<T>(actual: T, message?: string): Assertion<void, T>

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

Subscribe
  • expect.soft
  • expect.poll
  • toHaveBeenCalled
  • toHaveBeenCalledTimes
  • vi.spyOn

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