Skip to content

Commit

Permalink
[eslint] enable no-unused-vars
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jul 26, 2021
1 parent 771f3dd commit 2ebd23a
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .eslintrc
Expand Up @@ -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": {
Expand Down
2 changes: 2 additions & 0 deletions index.js
Expand Up @@ -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; });
Expand Down
2 changes: 2 additions & 0 deletions lib/test.js
Expand Up @@ -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 = {};
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions test/import.js
Expand Up @@ -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);
});
};
Expand Down Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion test/promises/fail.js
Expand Up @@ -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'));
});
Expand Down
3 changes: 1 addition & 2 deletions test/require.js
Expand Up @@ -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 });
}
4 changes: 0 additions & 4 deletions test/skip.js
@@ -1,7 +1,6 @@
'use strict';

var test = require('../');
var ran = 0;

var concat = require('concat-stream');
var tap = require('tap');
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 2ebd23a

Please sign in to comment.