diff --git a/lib/test.js b/lib/test.js index e1b56686..bc463fcd 100644 --- a/lib/test.js +++ b/lib/test.js @@ -261,7 +261,8 @@ Test.prototype._assert = function assert(ok, opts) { this._ok = !!(this._ok && ok); if (!ok && !res.todo) { - res.error = defined(extra.error, opts.error, new Error(res.name)); + var anError = res.name instanceof Error ? res.name : new Error(res.name); + res.error = defined(extra.error, opts.error, anError); } if (!ok) {