diff --git a/.eslintrc b/.eslintrc index 796fc4a1..8a282503 100644 --- a/.eslintrc +++ b/.eslintrc @@ -12,7 +12,7 @@ "rules": { "array-bracket-spacing": "off", "complexity": "off", - "func-style": "warn", + "func-style": ["error", "declaration"], "no-magic-numbers": "off", "max-lines": "warn", "max-lines-per-function": "warn", @@ -105,6 +105,7 @@ "allowKeywords": true, "allowPattern": "throws" }], + "func-style": "off", "id-length": "off", "max-len": "off", "max-lines-per-function": "off", diff --git a/index.js b/index.js index efd4bb3f..82f94ad8 100644 --- a/index.js +++ b/index.js @@ -24,10 +24,10 @@ module.exports = (function () { return harness; } - var lazyLoad = function () { + function lazyLoad() { // eslint-disable-next-line no-invalid-this return getHarness().apply(this, arguments); - }; + } lazyLoad.wait = function () { wait = true; @@ -72,7 +72,7 @@ function createHarness(conf_) { results.once('done', function () { results.close(); }); } - var test = function (name, conf, cb) { + function test(name, conf, cb) { var t = new Test(name, conf, cb); test._tests.push(t); @@ -87,7 +87,7 @@ function createHarness(conf_) { results.push(t); return t; - }; + } test._results = results; test._tests = []; diff --git a/lib/results.js b/lib/results.js index 97a731fc..5c6440b1 100644 --- a/lib/results.js +++ b/lib/results.js @@ -180,7 +180,8 @@ Results.prototype.only = function (t) { Results.prototype._watch = function (t) { var self = this; - var write = function (s) { self._stream.queue(s); }; + function write(s) { self._stream.queue(s); } + t.once('prerun', function () { var premsg = ''; if (t._skip) { @@ -214,7 +215,8 @@ Results.prototype.close = function () { var self = this; if (self.closed) { self._stream.emit('error', new Error('ALREADY CLOSED')); } self.closed = true; - var write = function (s) { self._stream.queue(s); }; + + function write(s) { self._stream.queue(s); } write('\n1..' + self.count + '\n'); write('# tests ' + self.count + '\n'); diff --git a/lib/test.js b/lib/test.js index 99225dca..d2b19806 100644 --- a/lib/test.js +++ b/lib/test.js @@ -33,7 +33,7 @@ var safeSetTimeout = setTimeout; var safeClearTimeout = clearTimeout; // eslint-disable-next-line no-unused-vars -var getTestArgs = function (name_, opts_, cb_) { +function getTestArgs(name_, opts_, cb_) { var name = '(anonymous)'; var opts = {}; var cb; @@ -54,7 +54,7 @@ var getTestArgs = function (name_, opts_, cb_) { opts: opts, cb: cb }; -}; +} function Test(name_, opts_, cb_) { if (!(this instanceof Test)) { @@ -427,7 +427,7 @@ Test.prototype.skip = function skip(msg, extra) { }); }; -var testAssert = function assert(value, msg, extra) { +var testAssert = function assert(value, msg, extra) { // eslint-disable-line func-style this._assert(value, { message: defined(msg, 'should be truthy'), operator: 'ok',