diff --git a/lib/ext/_assert.js b/lib/ext/_assert.js index 8ca1036..7d0e6a2 100644 --- a/lib/ext/_assert.js +++ b/lib/ext/_assert.js @@ -206,7 +206,7 @@ function expectedException(actual, expected) { if (Object.prototype.toString.call(expected) == "[object RegExp]") { return expected.test(actual); - } else if (actual instanceof expected) { + } else if (expected.prototype && actual instanceof expected) { return true; } else if (expected.call({}, actual) === true) { return true; diff --git a/test/ext/assert.test.js b/test/ext/assert.test.js index 3aa26a0..5b73056 100644 --- a/test/ext/assert.test.js +++ b/test/ext/assert.test.js @@ -251,6 +251,9 @@ describe("assert", function() { ); threw = false; + // if passing a arrow function, catch all + assert.throws(makeBlock(thrower, TypeError), () => true); + // doesNotThrow should pass through all errors try { assert.doesNotThrow(makeBlock(thrower, TypeError), assert.AssertionError);