Skip to content

Commit

Permalink
Merge pull request #145 from wilmoore/guard-on-uncaught
Browse files Browse the repository at this point in the history
add caught guard to avoid referencing undefined property
  • Loading branch information
Raynos committed Feb 5, 2015
2 parents 51f2f97 + 47f507f commit 36a1891
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ Test.prototype['throws'] = function (fn, expected, msg, extra) {
expected = String(expected);
}

if (typeof expected === 'function') {
if (typeof expected === 'function' && caught) {
passed = caught.error instanceof expected;
caught.error = caught.error.constructor;
}
Expand Down

0 comments on commit 36a1891

Please sign in to comment.