method
test.MatchersBuiltin.toThrowErrorMatchingSnapshot
hint?: string
): void;
Asserts that a function throws an error matching the most recent snapshot.
@param hint
Hint used to identify the snapshot in the snapshot file.
function fail() {
throw new Error("Oops!");
}
expect(fail).toThrowErrorMatchingSnapshot();
expect(fail).toThrowErrorMatchingSnapshot("This one should say Oops!");