Skip to content

Commit

Permalink
Merge pull request #232 from laconbass/assert-throws
Browse files Browse the repository at this point in the history
Avoid error instantiation if possible on assert.throws
  • Loading branch information
logicalparadox committed Jan 29, 2014
2 parents b01eba7 + 3741f05 commit be23285
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/chai/core/assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,10 @@ module.exports = function (chai, _) {
constructor = null;
errMsg = null;
} else if (typeof constructor === 'function') {
name = (new constructor()).name;
name = constructor.prototype.name || constructor.name;
if (name === 'Error' && constructor !== Error) {
name = (new constructor()).name;
}
} else {
constructor = null;
}
Expand Down

0 comments on commit be23285

Please sign in to comment.