From da0cdf1651fec20f66a6bed2d1b17944e18dcd48 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 24 Jul 2021 09:17:01 -0700 Subject: [PATCH] [Refactor] remove unused line, unneeded var initialization; add missing `new` --- lib/test.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/test.js b/lib/test.js index 6a1c488d..b5a6b08a 100644 --- a/lib/test.js +++ b/lib/test.js @@ -146,8 +146,7 @@ Test.prototype.timeoutAfter = function (ms) { }); }; -Test.prototype.end = function (err) { - var self = this; +Test.prototype.end = function end(err) { if (arguments.length >= 1 && !!err) { this.ifError(err); } @@ -493,7 +492,7 @@ Test.prototype['throws'] = function (fn, expected, msg, extra) { expected = undefined; } - var caught = undefined; + var caught; try { fn(); @@ -532,11 +531,10 @@ Test.prototype.doesNotThrow = function (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, { @@ -595,7 +593,7 @@ Test.prototype.doesNotMatch = function doesNotMatch(string, regexp, msg, extra) Test.skip = function (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: