File tree 1 file changed +18
-0
lines changed
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,24 @@ const expect = Code.expect;
179
179
expect (new Date ()).to .be .a .date ();
180
180
```
181
181
182
+ ##### ` error([type], [message]) `
183
+
184
+ Asserts that the reference value is an error. You can provide optional requirements where:
185
+ - ` type ` - the ` instanceof ` value of the error.
186
+ - ` message ` a string or regular expression matching the error ` message ` property. Note that a string
187
+ must provide a full match.
188
+
189
+ ``` js
190
+ const Code = require (' code' );
191
+ const expect = Code .expect ;
192
+
193
+ const err = new Error (' Oops an error occured.' );
194
+ expect (err).to .be .an .error ();
195
+ expect (err).to .be .an .error (Error );
196
+ expect (err).to .be .an .error (' Oops an error occured.' );
197
+ expect (err).to .be .an .error (Error , / occured/ );
198
+ ```
199
+
182
200
##### ` function() `
183
201
184
202
Asserts that the reference value is a ` function ` .
You can’t perform that action at this time.
0 commit comments