From 077a108686590363f23ba2ecf2c782016a1683e9 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Fri, 23 Jul 2021 23:41:09 -0700 Subject: [PATCH] [Refactor] add names to `Test.prototype` functions --- lib/test.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/test.js b/lib/test.js index f477cfa1..a823957a 100644 --- a/lib/test.js +++ b/lib/test.js @@ -96,7 +96,7 @@ function Test(name_, opts_, cb_) { } } -Test.prototype.run = function () { +Test.prototype.run = function run() { this.emit('prerun'); if (!this._cb || this._skip) { return this._end(); @@ -131,7 +131,7 @@ Test.prototype.run = function () { this.emit('run'); }; -Test.prototype.test = function (name, opts, cb) { +Test.prototype.test = function test(name, opts, cb) { var self = this; var t = new Test(name, opts, cb); $push(this._progeny, t); @@ -154,19 +154,19 @@ Test.prototype.test = function (name, opts, cb) { }); }; -Test.prototype.comment = function (msg) { +Test.prototype.comment = function comment(msg) { var that = this; forEach($split(trim(msg), '\n'), function (aMsg) { that.emit('result', $replace(trim(aMsg), /^#\s*/, '')); }); }; -Test.prototype.plan = function (n) { +Test.prototype.plan = function plan(n) { this._plan = n; this.emit('plan', n); }; -Test.prototype.timeoutAfter = function (ms) { +Test.prototype.timeoutAfter = function timeoutAfter(ms) { if (!ms) throw new Error('timeoutAfter requires a timespan'); var self = this; var timeout = safeSetTimeout(function () { @@ -178,7 +178,7 @@ Test.prototype.timeoutAfter = function (ms) { }); }; -Test.prototype.end = function (err) { +Test.prototype.end = function end(err) { var self = this; if (arguments.length >= 1 && !!err) { this.ifError(err); @@ -191,7 +191,7 @@ Test.prototype.end = function (err) { this._end(); }; -Test.prototype.teardown = function (fn) { +Test.prototype.teardown = function teardown(fn) { if (typeof fn !== 'function') { this.fail('teardown: ' + inspect(fn) + ' is not a function'); } else { @@ -199,7 +199,7 @@ Test.prototype.teardown = function (fn) { } }; -Test.prototype._end = function (err) { +Test.prototype._end = function _end(err) { var self = this; if (!this._cb && !this._todo && !this._skip) this.fail('# TODO ' + this.name); @@ -249,7 +249,7 @@ Test.prototype._end = function (err) { } }; -Test.prototype._exit = function () { +Test.prototype._exit = function _exit() { if (this._plan !== undefined && !this._planError && this.assertCount !== this._plan) { this._planError = true; this.fail('plan != count', { @@ -264,7 +264,7 @@ Test.prototype._exit = function () { } }; -Test.prototype._pendingAsserts = function () { +Test.prototype._pendingAsserts = function _pendingAsserts() { if (this._plan === undefined) { return 1; } @@ -394,7 +394,7 @@ Test.prototype._assert = function assert(ok, opts) { } }; -Test.prototype.fail = function (msg, extra) { +Test.prototype.fail = function fail(msg, extra) { this._assert(false, { message: msg, operator: 'fail', @@ -402,7 +402,7 @@ Test.prototype.fail = function (msg, extra) { }); }; -Test.prototype.pass = function (msg, extra) { +Test.prototype.pass = function pass(msg, extra) { this._assert(true, { message: msg, operator: 'pass', @@ -410,7 +410,7 @@ Test.prototype.pass = function (msg, extra) { }); }; -Test.prototype.skip = function (msg, extra) { +Test.prototype.skip = function skip(msg, extra) { this._assert(true, { message: msg, operator: 'skip', @@ -676,7 +676,7 @@ Test.prototype['throws'] = function (fn, expected, msg, extra) { }); }; -Test.prototype.doesNotThrow = function (fn, expected, msg, extra) { +Test.prototype.doesNotThrow = function doesNotThrow(fn, expected, msg, extra) { if (typeof expected === 'string') { msg = expected; expected = undefined; @@ -741,7 +741,7 @@ Test.prototype.doesNotMatch = function doesNotMatch(string, regexp, msg, extra) }); }; -Test.skip = function (name_, _opts, _cb) { +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);