Skip to content

Commit

Permalink
test: remove unused modules
Browse files Browse the repository at this point in the history
Many tests use require() to import modules that subsequently never gets
used. This removes those imports and, in a few cases, removes other
unused variables from tests.

PR-URL: #4475
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
  • Loading branch information
Trott committed Jan 2, 2016
1 parent b16a50d commit 6abd8b5
Show file tree
Hide file tree
Showing 29 changed files with 5 additions and 47 deletions.
2 changes: 1 addition & 1 deletion test/addons/at-exit/test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
'use strict';
require('../../common');
var binding = require('./build/Release/binding');
require('./build/Release/binding');
2 changes: 0 additions & 2 deletions test/internet/test-dns-ipv4.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ var common = require('../common');
var assert = require('assert'),
dns = require('dns'),
net = require('net'),
isIP = net.isIP,
isIPv4 = net.isIPv4;
var util = require('util');

var expected = 0,
completed = 0,
Expand Down
2 changes: 0 additions & 2 deletions test/internet/test-dns-ipv6.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ var common = require('../common');
var assert = require('assert'),
dns = require('dns'),
net = require('net'),
isIP = net.isIP,
isIPv6 = net.isIPv6;
var util = require('util');

var expected = 0,
completed = 0,
Expand Down
1 change: 0 additions & 1 deletion test/message/2100bytes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
require('../common');
var util = require('util');

console.log([
'_______________________________________________50',
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-cluster-eaddrinuse.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

var common = require('../common');
var assert = require('assert');
var cluster = require('cluster');
var fork = require('child_process').fork;
var net = require('net');

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-cluster-worker-forced-exit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
require('../common');
var assert = require('assert');
var cluster = require('cluster');
var net = require('net');

var SENTINEL = 42;

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-crypto-certificate.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ var crypto = require('crypto');
crypto.DEFAULT_ENCODING = 'buffer';

var fs = require('fs');
var path = require('path');

// Test Certificates
var spkacValid = fs.readFileSync(common.fixturesDir + '/spkac.valid');
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-dgram-send-callback-buffer-length.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
var common = require('../common');
var assert = require('assert');

var fs = require('fs');
var dgram = require('dgram');
var callbacks = 0;
var client, timer, buf, len, offset;


Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-dgram-udp4.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
var common = require('../common');
var assert = require('assert');

var fs = require('fs'),
dgram = require('dgram'), server, client,
var dgram = require('dgram'), server, client,
server_port = common.PORT,
message_to_send = 'A message to send',
timer;
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-domain-multi.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
var common = require('../common');
var assert = require('assert');
var domain = require('domain');
var events = require('events');

var caughtA = false;
var caughtB = false;
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-eval-require.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
var common = require('../common');
var assert = require('assert');
var spawn = require('child_process').spawn;
var path = require('path');
var fs = require('fs');

var options = {
cwd: common.fixturesDir
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-event-emitter-listeners-side-effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

require('../common');
var assert = require('assert');
var events = require('events');

var EventEmitter = require('events').EventEmitter;
var assert = require('assert');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-fs-readdir.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const common = require('../common');
const assert = require('assert');
const path = require('path');
const fs = require('fs');

const readdirDir = common.tmpDir;
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-listen-fd-cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var assert = require('assert');
var http = require('http');
var net = require('net');
var PORT = common.PORT;
var spawn = require('child_process').spawn;
var cluster = require('cluster');

console.error('Cluster listen fd test', process.argv[2] || 'runner');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-listen-fd-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var assert = require('assert');
var http = require('http');
var net = require('net');
var PORT = common.PORT;
var spawn = require('child_process').spawn;

if (common.isWindows) {
console.log('1..0 # Skipped: This test is disabled on windows.');
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-readline-keys.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
require('../common');
var EventEmitter = require('events').EventEmitter;
var PassThrough = require('stream').PassThrough;
var assert = require('assert');
var inherits = require('util').inherits;
Expand All @@ -16,7 +15,7 @@ inherits(FakeInput, PassThrough);

var fi = new FakeInput();
var fo = new FakeInput();
var rli = new Interface({ input: fi, output: fo, terminal: true });
new Interface({ input: fi, output: fo, terminal: true });

var keys = [];
fi.on('keypress', function(s, k) {
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-tick-processor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var fs = require('fs');
var assert = require('assert');
var path = require('path');
var cp = require('child_process');
var common = require('../common');

Expand Down
6 changes: 0 additions & 6 deletions test/parallel/test-tls-legacy-onselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@ if (!common.hasCrypto) {
var tls = require('tls');
var net = require('net');

var fs = require('fs');

var success = false;

function filenamePEM(n) {
return require('path').join(common.fixturesDir, 'keys', n + '.pem');
}

var server = net.Server(function(raw) {
var pair = tls.createSecurePair(null, true, false, false);
pair.on('error', function() {});
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-zlib-dictionary.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
require('../common');
const assert = require('assert');
const zlib = require('zlib');
const path = require('path');

const spdyDict = new Buffer([
'optionsgetheadpostputdeletetraceacceptaccept-charsetaccept-encodingaccept-',
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-zlib-flush-drain.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
require('../common');
const assert = require('assert');
const zlib = require('zlib');
const path = require('path');

const bigData = new Buffer(10240).fill('x');

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-zlib-write-after-flush.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
require('../common');
var assert = require('assert');
var zlib = require('zlib');
var fs = require('fs');

var gzip = zlib.createGzip();
var gunz = zlib.createUnzip();
Expand Down
3 changes: 0 additions & 3 deletions test/pummel/test-dtrace-jsstack.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
require('../common');
var assert = require('assert');
var os = require('os');
var util = require('util');

if (os.type() != 'SunOS') {
console.log('1..0 # Skipped: no DTRACE support');
Expand All @@ -13,7 +12,6 @@ if (os.type() != 'SunOS') {
* Some functions to create a recognizable stack.
*/
var frames = [ 'stalloogle', 'bagnoogle', 'doogle' ];
var expected;

var stalloogle = function(str) {
expected = str;
Expand All @@ -35,7 +33,6 @@ var doogle = function() {

var spawn = require('child_process').spawn;
var prefix = '/var/tmp/node';
var corefile = prefix + '.' + process.pid;

/*
* We're going to use DTrace to stop us, gcore us, and set us running again
Expand Down
1 change: 0 additions & 1 deletion test/pummel/test-http-client-reconnect-bug.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ var common = require('../common');
var assert = require('assert');

var net = require('net'),
util = require('util'),
http = require('http');

var errorCount = 0;
Expand Down
1 change: 0 additions & 1 deletion test/pummel/test-keep-alive.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ var common = require('../common');
var assert = require('assert');
var spawn = require('child_process').spawn;
var http = require('http');
var path = require('path');
var url = require('url');

if (common.isWindows) {
Expand Down
3 changes: 1 addition & 2 deletions test/pummel/test-timer-wrap2.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
'use strict';
require('../common');
var assert = require('assert');

// Test that allocating a timer does not increase the loop's reference
// count.

var Timer = process.binding('timer_wrap').Timer;
var t = new Timer();
new Timer();
4 changes: 0 additions & 4 deletions test/pummel/test-tls-securepair-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ var join = require('path').join;
var net = require('net');
var assert = require('assert');
var fs = require('fs');
var crypto = require('crypto');
var tls = require('tls');
var exec = require('child_process').exec;
var spawn = require('child_process').spawn;

test1();
Expand Down Expand Up @@ -47,8 +45,6 @@ function test(keyfn, certfn, check, next) {
// EADDRINUSE.
var PORT = common.PORT + 5;

var connections = 0;

keyfn = join(common.fixturesDir, keyfn);
var key = fs.readFileSync(keyfn).toString();

Expand Down
1 change: 0 additions & 1 deletion test/sequential/test-child-process-execsync.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common');
var assert = require('assert');
var os = require('os');

var execSync = require('child_process').execSync;
var execFileSync = require('child_process').execFileSync;
Expand Down
3 changes: 1 addition & 2 deletions test/sequential/test-regress-GH-1697.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use strict';
var common = require('../common');
var net = require('net'),
cp = require('child_process'),
util = require('util');
cp = require('child_process');

if (process.argv[2] === 'server') {
// Server
Expand Down
1 change: 0 additions & 1 deletion test/sequential/test-stdout-close-catch.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ var common = require('../common');
var assert = require('assert');
var path = require('path');
var child_process = require('child_process');
var fs = require('fs');

var testScript = path.join(common.fixturesDir, 'catch-stdout-error.js');

Expand Down

0 comments on commit 6abd8b5

Please sign in to comment.