You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/03-assertions.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -207,19 +207,19 @@ Assert that `value` is deeply equal to `expected`. See [Concordance](https://git
207
207
208
208
Assert that `value` is not deeply equal to `expected`. The inverse of `.deepEqual()`.
209
209
210
-
### `.throws(fn, [expected, [message]])`
210
+
### `.throws(fn, [expectation, [message]])`
211
211
212
212
Assert that an error is thrown. `fn` must be a function which should throw. The thrown value *must* be an error. It is returned so you can run more assertions against it.
213
213
214
-
`expected` can be a constructor, in which case the thrown error must be an instance of the constructor. It can be a string, which is compared against the thrown error's message, or a regular expression which is matched against this message. You can also specify a matcher object with one or more of the following properties:
214
+
`expectation` can be an object with one or more of the following properties:
215
215
216
216
*`instanceOf`: a constructor, the thrown error must be an instance of
217
-
*`is`: the thrown error must be strictly equal to `expected.is`
217
+
*`is`: the thrown error must be strictly equal to `expectation.is`
218
218
*`message`: either a string, which is compared against the thrown error's message, or a regular expression, which is matched against this message
219
219
*`name`: the expected `.name` value of the thrown error
220
220
*`code`: the expected `.code` value of the thrown error
221
221
222
-
`expected` does not need to be specified. If you don't need it but do want to set an assertion message you have to specify `null`.
222
+
`expectation` does not need to be specified. If you don't need it but do want to set an assertion message you have to specify `null`.
Assert that an error is thrown. `thrower` can be an async function which should throw, or a promise that should reject. This assertion must be awaited.
243
243
244
244
The thrown value *must* be an error. It is returned so you can run more assertions against it.
245
245
246
-
`expected` can be a constructor, in which case the thrown error must be an instance of the constructor. It can be a string, which is compared against the thrown error's message, or a regular expression which is matched against this message. You can also specify a matcher object with one or more of the following properties:
246
+
`expectation` can be an object with one or more of the following properties:
247
247
248
248
*`instanceOf`: a constructor, the thrown error must be an instance of
249
-
*`is`: the thrown error must be strictly equal to `expected.is`
249
+
*`is`: the thrown error must be strictly equal to `expectation.is`
250
250
*`message`: either a string, which is compared against the thrown error's message, or a regular expression, which is matched against this message
251
251
*`name`: the expected `.name` value of the thrown error
252
252
*`code`: the expected `.code` value of the thrown error
253
253
254
-
`expected` does not need to be specified. If you don't need it but do want to set an assertion message you have to specify `null`.
254
+
`expectation` does not need to be specified. If you don't need it but do want to set an assertion message you have to specify `null`.
0 commit comments