Skip to content

Commit

Permalink
docs: improve throws examples (#1113)
Browse files Browse the repository at this point in the history
When throws is invoked with two arguments, where the second is a string or regexp, the second argument is the **errMsgMatcher**. The current examples imply that this string is the **message**  rather than the matcher.
  • Loading branch information
ColinEberhardt authored and lucasfcosta committed Jan 4, 2018
1 parent 9c1a99f commit f54f71c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/chai/interface/assert.js
Expand Up @@ -1940,8 +1940,8 @@ module.exports = function (chai, util) {
* If `errMsgMatcher` is provided, it also asserts that the error thrown will have a
* message matching `errMsgMatcher`.
*
* assert.throws(fn, 'function throws a reference error');
* assert.throws(fn, /function throws a reference error/);
* assert.throws(fn, 'Error thrown must have this msg');
* assert.throws(fn, /Error thrown must have a msg that matches this/);
* assert.throws(fn, ReferenceError);
* assert.throws(fn, errorInstance);
* assert.throws(fn, ReferenceError, 'Error thrown must be a ReferenceError and have this msg');
Expand Down

0 comments on commit f54f71c

Please sign in to comment.