Skip to content
masterclass Buddy

Vitest · Matcher

toHaveResolvedWith

toHaveResolvedWith checks that a spy function has successfully resolved a specified value at least once. It uses deep equality like toEqual and fails if the relevant promise is still pending.

Last updated

Syntax

toHaveResolvedWith(returnValue: any): Awaitable<void>

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

Subscribe
  • toHaveResolvedTimes
  • toHaveLastResolvedWith
  • toHaveNthResolvedWith
  • vi.fn
  • expect

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