Skip to content
masterclass Buddy

Jest · Matcher

toHaveReturned

toHaveReturned() checks that a Jest mock function successfully returned at least once. Calls that throw an error do not count.

Last updated

Syntax

expect(mockFunction).toHaveReturned()

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

Subscribe
  • toHaveReturnedTimes
  • toHaveReturnedWith
  • toHaveLastReturnedWith
  • toHaveNthReturnedWith

Source: Expect · Jest. Checked 2026-11-03.