diff --git a/lib/test.js b/lib/test.js index a823957a..ed005cb6 100644 --- a/lib/test.js +++ b/lib/test.js @@ -179,7 +179,6 @@ Test.prototype.timeoutAfter = function timeoutAfter(ms) { }; Test.prototype.end = function end(err) { - var self = this; if (arguments.length >= 1 && !!err) { this.ifError(err); } @@ -211,7 +210,6 @@ Test.prototype._end = function _end(err) { return; } - function next() { if (self._teardown.length === 0) { completeEnd(); @@ -616,7 +614,7 @@ Test.prototype['throws'] = function (fn, expected, msg, extra) { expected = undefined; } - var caught = undefined; + var caught; try { fn(); @@ -681,11 +679,10 @@ Test.prototype.doesNotThrow = function doesNotThrow(fn, expected, msg, extra) { msg = expected; expected = undefined; } - var caught = undefined; + var caught; try { fn(); - } - catch (err) { + } catch (err) { caught = { error: err }; } this._assert(!caught, { @@ -744,7 +741,7 @@ Test.prototype.doesNotMatch = function doesNotMatch(string, regexp, msg, extra) Test.skip = function skip(name_, _opts, _cb) { var args = getTestArgs.apply(null, arguments); args.opts.skip = true; - return Test(args.name, args.opts, args.cb); + return new Test(args.name, args.opts, args.cb); }; // vim: set softtabstop=4 shiftwidth=4: