Skip to content

Commit ab462ea

Browse files
committed
add document
1 parent 14cf63d commit ab462ea

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/ExpectAPI.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,12 @@ exports[`drinking flavors throws on octopus 1`] = `"yuck, octopus flavor"`;
886886

887887
Check out [React Tree Snapshot Testing](/blog/2016/07/27/jest-14) for more information on snapshot testing.
888888

889+
### `.toThrowErrorMatchingNamedSnapshot(snapshotName?)`
890+
891+
Use `.toThrowErrorMatchingNamedSnapshot` to test that a functino throws an error matching the most recent snapshot when it is called.
892+
893+
You can provide an optional `snapshotName` string argument that functions as the test name. By providing a snapshot name (as opposed to letting Jest infer the name from context) snapshot names can be guaranteed to be consistent across test runs, whatever the context at the time of evaluation. Jest always appends a number at the end of a snapshot name.
894+
889895
### `.toThrowErrorMatchingInlineSnapshot(inlineSnapshot)`
890896

891897
Use `.toThrowErrorMatchingInlineSnapshot` to test that a function throws an error matching the most recent snapshot when it is called.

0 commit comments

Comments
 (0)