diff --git a/.eslintrc b/.eslintrc index 235361f5..429f72f2 100644 --- a/.eslintrc +++ b/.eslintrc @@ -45,6 +45,10 @@ "allow": [] }], "no-undef": "error", + "no-unused-vars": ["error", { + "vars": "all", + "args": "after-used" + }], "no-useless-escape": "error", "object-curly-newline": ["error", { "ObjectExpression": { diff --git a/index.js b/index.js index 10200482..386e16b6 100644 --- a/index.js +++ b/index.js @@ -107,6 +107,8 @@ function createExitHarness(conf, wait) { var stream = harness.createStream({ objectMode: config.objectMode }); var es = stream.pipe(config.stream || createDefaultStream()); if (canEmitExit) { + // TODO: use `err` arg? + // eslint-disable-next-line no-unused-vars es.on('error', function (err) { harness._exitCode = 1; }); } stream.on('end', function () { ended = true; }); diff --git a/lib/test.js b/lib/test.js index 71325f52..31275195 100644 --- a/lib/test.js +++ b/lib/test.js @@ -33,6 +33,7 @@ var safeClearTimeout = clearTimeout; inherits(Test, EventEmitter); +// eslint-disable-next-line no-unused-vars var getTestArgs = function (name_, opts_, cb_) { var name = '(anonymous)'; var opts = {}; @@ -744,6 +745,7 @@ Test.prototype.doesNotMatch = function doesNotMatch(string, regexp, msg, extra) }); }; +// eslint-disable-next-line no-unused-vars Test.skip = function skip(name_, _opts, _cb) { var args = getTestArgs.apply(null, arguments); args.opts.skip = true; diff --git a/test/import.js b/test/import.js index b76e5bc9..e2581e75 100644 --- a/test/import.js +++ b/test/import.js @@ -92,7 +92,7 @@ tap.test('errors importing test files', function (t) { var message = options.error + ' in `' + options.mode + '` mode`'; var ps = tape(options.files, { env: { NODE_OPTIONS: '--unhandled-rejections=' + options.mode } }); ps.stderr.pipe(concat(options.unhandledRejection(message))); - ps.on('exit', function (code, sig) { + ps.on('exit', function (code/* , sig */) { t.equal(code, options.exitCode, message + ' has exit code ' + options.exitCode); }); }; @@ -191,8 +191,7 @@ tap.test('errors importing test files', function (t) { function tape(args, options) { options = assign({ cwd: __dirname }, options); - var proc = require('child_process'); var bin = __dirname + '/../bin/tape'; - return proc.spawn('node', [bin].concat(args.split(' ')), options); + return spawn('node', [bin].concat(args.split(' ')), options); } diff --git a/test/promises/fail.js b/test/promises/fail.js index 6ffb3f8d..5047c0b9 100644 --- a/test/promises/fail.js +++ b/test/promises/fail.js @@ -3,7 +3,7 @@ var test = require('../../'); if (typeof Promise === 'function' && typeof Promise.resolve === 'function') { - test('promise', function (t) { + test('promise', function () { return new Promise(function (resolve, reject) { reject(new Error('rejection message')); }); diff --git a/test/require.js b/test/require.js index d0c7c813..14014cdd 100644 --- a/test/require.js +++ b/test/require.js @@ -64,8 +64,7 @@ tap.test('requiring multiple modules', function (t) { }); function tape(args) { - var proc = require('child_process'); var bin = __dirname + '/../bin/tape'; - return proc.spawn('node', [bin].concat(args.split(' ')), { cwd: __dirname }); + return spawn('node', [bin].concat(args.split(' ')), { cwd: __dirname }); } diff --git a/test/skip.js b/test/skip.js index 7a1523de..d0843599 100644 --- a/test/skip.js +++ b/test/skip.js @@ -1,7 +1,6 @@ 'use strict'; var test = require('../'); -var ran = 0; var concat = require('concat-stream'); var tap = require('tap'); @@ -32,18 +31,15 @@ tap.test('test SKIP comment', function (assert) { test('skip this', { skip: true }, function (t) { t.fail('this should not even run'); - ran++; t.end(); }); test.skip('skip this too', function (t) { t.fail('this should not even run'); - ran++; t.end(); }); test('skip subtest', function (t) { - ran++; t.test('skip this', { skip: true }, function (st) { st.fail('this should not even run'); st.end();