From f54f71c23493681deed2b22accb1adf1f9a677c3 Mon Sep 17 00:00:00 2001 From: Colin Eberhardt Date: Thu, 4 Jan 2018 21:31:39 +0000 Subject: [PATCH] docs: improve throws examples (#1113) 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. --- lib/chai/interface/assert.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/chai/interface/assert.js b/lib/chai/interface/assert.js index 03dfd103c..7772e2c4b 100644 --- a/lib/chai/interface/assert.js +++ b/lib/chai/interface/assert.js @@ -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');