Skip to content
masterclass Buddy

Vitest · Matcher

toThrowErrorMatchingSnapshot

Checks the value thrown by a function against a stored snapshot. The test fails when the thrown value does not match the saved snapshot.

Last updated

Syntax

toThrowErrorMatchingSnapshot(hint?: string): void

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

Subscribe
  • toMatchSnapshot
  • toThrowErrorMatchingInlineSnapshot
  • toMatchInlineSnapshot
  • expect

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