From 995ddb254ab5e6048b4d049b902601b597ff24e0 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 4 Dec 2016 00:14:14 -0800 Subject: [PATCH] [Cleanup] elses need cuddles --- lib/default_stream.js | 3 +-- lib/results.js | 6 ++---- lib/test.js | 15 +++++---------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/lib/default_stream.js b/lib/default_stream.js index c8e99180..12051773 100644 --- a/lib/default_stream.js +++ b/lib/default_stream.js @@ -21,8 +21,7 @@ module.exports = function () { if (fs.writeSync && /^win/.test(process.platform)) { try { fs.writeSync(1, line + '\n'); } catch (e) { stream.emit('error', e) } - } - else { + } else { try { console.log(line) } catch (e) { stream.emit('error', e) } } diff --git a/lib/results.js b/lib/results.js index 35bf09f3..36586530 100644 --- a/lib/results.js +++ b/lib/results.js @@ -59,8 +59,7 @@ Results.prototype.createStream = function (opts) { }); }); self.on('done', function () { output.queue(null) }); - } - else { + } else { output = resumer(); output.queue('TAP version 13\n'); self._stream.pipe(output); @@ -149,8 +148,7 @@ function encodeResult (res, count) { if (Math.max(ex.length, ac.length) > 65 || invalidYaml(ex) || invalidYaml(ac)) { output += inner + 'expected: |-\n' + inner + ' ' + ex + '\n'; output += inner + 'actual: |-\n' + inner + ' ' + ac + '\n'; - } - else { + } else { output += inner + 'expected: ' + ex + '\n'; output += inner + 'actual: ' + ac + '\n'; } diff --git a/lib/test.js b/lib/test.js index 0b48ed6f..d08ad99b 100644 --- a/lib/test.js +++ b/lib/test.js @@ -29,11 +29,9 @@ var getTestArgs = function (name_, opts_, cb_) { var t = typeof arg; if (t === 'string') { name = arg; - } - else if (t === 'object') { + } else if (t === 'object') { opts = arg || opts; - } - else if (t === 'function') { + } else if (t === 'function') { cb = arg; } } @@ -66,7 +64,7 @@ function Test (name_, opts_, cb_) { return val.apply(self, arguments); }; } - else return val; + return val; })(this, this[prop]); } } @@ -176,8 +174,7 @@ Test.prototype._exit = function () { actual : this.assertCount, exiting : true }); - } - else if (!this.ended) { + } else if (!this.ended) { this.fail('test exited without ending', { exiting: true }); @@ -188,9 +185,7 @@ Test.prototype._pendingAsserts = function () { if (this._plan === undefined) { return 1; } - else { - return this._plan - (this._progeny.length + this.assertCount); - } + return this._plan - (this._progeny.length + this.assertCount); }; Test.prototype._assert = function assert (ok, opts) {