From 105f7db4a13f80449c37881622719099ad915703 Mon Sep 17 00:00:00 2001 From: Diego Faria Date: Thu, 14 Sep 2017 01:01:59 +0200 Subject: [PATCH] Improve docs (#4478) --- docs/en/ExpectAPI.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/en/ExpectAPI.md b/docs/en/ExpectAPI.md index 1cfec4c90727..e0969cd0893d 100644 --- a/docs/en/ExpectAPI.md +++ b/docs/en/ExpectAPI.md @@ -863,6 +863,8 @@ test('throws on octopus', () => { }); ``` +> Note: You must wrap the code in a function, otherwise the error will not be caught and the assertion will fail. + ### `.toThrowErrorMatchingSnapshot()` Use `.toThrowErrorMatchingSnapshot` to test that a function throws an error matching the most recent snapshot when it is called. For example, let's say you have a `drinkFlavor` function that throws whenever the flavor is `'octopus'`, and is coded like this: