Browse Source

test: remove unused modules

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: https://github.com/nodejs/node/pull/4684
Reviewed-By: Myles Borins <mborins@us.ibm.com>
v4.x
Rich Trott 9 years ago
committed by Myles Borins
parent
commit
dffe83ccd6
  1. 2
      test/addons/at-exit/test.js
  2. 2
      test/internet/test-dns-ipv4.js
  3. 2
      test/internet/test-dns-ipv6.js
  4. 1
      test/message/2100bytes.js
  5. 1
      test/parallel/test-cluster-eaddrinuse.js
  6. 1
      test/parallel/test-cluster-worker-forced-exit.js
  7. 1
      test/parallel/test-crypto-certificate.js
  8. 2
      test/parallel/test-dgram-send-callback-buffer-length.js
  9. 3
      test/parallel/test-dgram-udp4.js
  10. 1
      test/parallel/test-domain-multi.js
  11. 2
      test/parallel/test-eval-require.js
  12. 1
      test/parallel/test-event-emitter-listeners-side-effects.js
  13. 1
      test/parallel/test-fs-readdir.js
  14. 1
      test/parallel/test-listen-fd-cluster.js
  15. 1
      test/parallel/test-listen-fd-server.js
  16. 3
      test/parallel/test-readline-keys.js
  17. 10
      test/parallel/test-tls-legacy-onselect.js
  18. 1
      test/parallel/test-zlib-dictionary.js
  19. 1
      test/parallel/test-zlib-flush-drain.js
  20. 1
      test/parallel/test-zlib-write-after-flush.js
  21. 3
      test/pummel/test-dtrace-jsstack.js
  22. 1
      test/pummel/test-http-client-reconnect-bug.js
  23. 1
      test/pummel/test-keep-alive.js
  24. 3
      test/pummel/test-timer-wrap2.js
  25. 4
      test/pummel/test-tls-securepair-client.js
  26. 1
      test/sequential/test-child-process-execsync.js
  27. 3
      test/sequential/test-regress-GH-1697.js
  28. 1
      test/sequential/test-stdout-close-catch.js

2
test/addons/at-exit/test.js

@ -1,3 +1,3 @@
'use strict'; 'use strict';
require('../../common'); require('../../common');
var binding = require('./build/Release/binding'); require('./build/Release/binding');

2
test/internet/test-dns-ipv4.js

@ -3,9 +3,7 @@ var common = require('../common');
var assert = require('assert'), var assert = require('assert'),
dns = require('dns'), dns = require('dns'),
net = require('net'), net = require('net'),
isIP = net.isIP,
isIPv4 = net.isIPv4; isIPv4 = net.isIPv4;
var util = require('util');
var expected = 0, var expected = 0,
completed = 0, completed = 0,

2
test/internet/test-dns-ipv6.js

@ -3,9 +3,7 @@ var common = require('../common');
var assert = require('assert'), var assert = require('assert'),
dns = require('dns'), dns = require('dns'),
net = require('net'), net = require('net'),
isIP = net.isIP,
isIPv6 = net.isIPv6; isIPv6 = net.isIPv6;
var util = require('util');
var expected = 0, var expected = 0,
completed = 0, completed = 0,

1
test/message/2100bytes.js

@ -1,6 +1,5 @@
'use strict'; 'use strict';
require('../common'); require('../common');
var util = require('util');
console.log([ console.log([
'_______________________________________________50', '_______________________________________________50',

1
test/parallel/test-cluster-eaddrinuse.js

@ -5,7 +5,6 @@
var common = require('../common'); var common = require('../common');
var assert = require('assert'); var assert = require('assert');
var cluster = require('cluster');
var fork = require('child_process').fork; var fork = require('child_process').fork;
var net = require('net'); var net = require('net');

1
test/parallel/test-cluster-worker-forced-exit.js

@ -2,7 +2,6 @@
require('../common'); require('../common');
var assert = require('assert'); var assert = require('assert');
var cluster = require('cluster'); var cluster = require('cluster');
var net = require('net');
var SENTINEL = 42; var SENTINEL = 42;

1
test/parallel/test-crypto-certificate.js

@ -11,7 +11,6 @@ var crypto = require('crypto');
crypto.DEFAULT_ENCODING = 'buffer'; crypto.DEFAULT_ENCODING = 'buffer';
var fs = require('fs'); var fs = require('fs');
var path = require('path');
// Test Certificates // Test Certificates
var spkacValid = fs.readFileSync(common.fixturesDir + '/spkac.valid'); var spkacValid = fs.readFileSync(common.fixturesDir + '/spkac.valid');

2
test/parallel/test-dgram-send-callback-buffer-length.js

@ -2,9 +2,7 @@
var common = require('../common'); var common = require('../common');
var assert = require('assert'); var assert = require('assert');
var fs = require('fs');
var dgram = require('dgram'); var dgram = require('dgram');
var callbacks = 0;
var client, timer, buf, len, offset; var client, timer, buf, len, offset;

3
test/parallel/test-dgram-udp4.js

@ -2,8 +2,7 @@
var common = require('../common'); var common = require('../common');
var assert = require('assert'); var assert = require('assert');
var fs = require('fs'), var dgram = require('dgram'), server, client,
dgram = require('dgram'), server, client,
server_port = common.PORT, server_port = common.PORT,
message_to_send = 'A message to send', message_to_send = 'A message to send',
timer; timer;

1
test/parallel/test-domain-multi.js

@ -4,7 +4,6 @@
var common = require('../common'); var common = require('../common');
var assert = require('assert'); var assert = require('assert');
var domain = require('domain'); var domain = require('domain');
var events = require('events');
var caughtA = false; var caughtA = false;
var caughtB = false; var caughtB = false;

2
test/parallel/test-eval-require.js

@ -2,8 +2,6 @@
var common = require('../common'); var common = require('../common');
var assert = require('assert'); var assert = require('assert');
var spawn = require('child_process').spawn; var spawn = require('child_process').spawn;
var path = require('path');
var fs = require('fs');
var options = { var options = {
cwd: common.fixturesDir cwd: common.fixturesDir

1
test/parallel/test-event-emitter-listeners-side-effects.js

@ -2,7 +2,6 @@
require('../common'); require('../common');
var assert = require('assert'); var assert = require('assert');
var events = require('events');
var EventEmitter = require('events').EventEmitter; var EventEmitter = require('events').EventEmitter;
var assert = require('assert'); var assert = require('assert');

1
test/parallel/test-fs-readdir.js

@ -2,7 +2,6 @@
const common = require('../common'); const common = require('../common');
const assert = require('assert'); const assert = require('assert');
const path = require('path');
const fs = require('fs'); const fs = require('fs');
const readdirDir = common.tmpDir; const readdirDir = common.tmpDir;

1
test/parallel/test-listen-fd-cluster.js

@ -4,7 +4,6 @@ var assert = require('assert');
var http = require('http'); var http = require('http');
var net = require('net'); var net = require('net');
var PORT = common.PORT; var PORT = common.PORT;
var spawn = require('child_process').spawn;
var cluster = require('cluster'); var cluster = require('cluster');
console.error('Cluster listen fd test', process.argv[2] || 'runner'); console.error('Cluster listen fd test', process.argv[2] || 'runner');

1
test/parallel/test-listen-fd-server.js

@ -4,7 +4,6 @@ var assert = require('assert');
var http = require('http'); var http = require('http');
var net = require('net'); var net = require('net');
var PORT = common.PORT; var PORT = common.PORT;
var spawn = require('child_process').spawn;
if (common.isWindows) { if (common.isWindows) {
console.log('1..0 # Skipped: This test is disabled on windows.'); console.log('1..0 # Skipped: This test is disabled on windows.');

3
test/parallel/test-readline-keys.js

@ -1,6 +1,5 @@
'use strict'; 'use strict';
require('../common'); require('../common');
var EventEmitter = require('events').EventEmitter;
var PassThrough = require('stream').PassThrough; var PassThrough = require('stream').PassThrough;
var assert = require('assert'); var assert = require('assert');
var inherits = require('util').inherits; var inherits = require('util').inherits;
@ -16,7 +15,7 @@ inherits(FakeInput, PassThrough);
var fi = new FakeInput(); var fi = new FakeInput();
var fo = 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 = []; var keys = [];
fi.on('keypress', function(s, k) { fi.on('keypress', function(s, k) {

10
test/parallel/test-tls-legacy-onselect.js

@ -9,18 +9,8 @@ if (!common.hasCrypto) {
var tls = require('tls'); var tls = require('tls');
var net = require('net'); var net = require('net');
var fs = require('fs');
var success = false; var success = false;
function filenamePEM(n) {
return require('path').join(common.fixturesDir, 'keys', n + '.pem');
}
function loadPEM(n) {
return fs.readFileSync(filenamePEM(n));
}
var server = net.Server(function(raw) { var server = net.Server(function(raw) {
var pair = tls.createSecurePair(null, true, false, false); var pair = tls.createSecurePair(null, true, false, false);
pair.on('error', function() {}); pair.on('error', function() {});

1
test/parallel/test-zlib-dictionary.js

@ -4,7 +4,6 @@
require('../common'); require('../common');
const assert = require('assert'); const assert = require('assert');
const zlib = require('zlib'); const zlib = require('zlib');
const path = require('path');
var spdyDict = new Buffer([ var spdyDict = new Buffer([
'optionsgetheadpostputdeletetraceacceptaccept-charsetaccept-encodingaccept-', 'optionsgetheadpostputdeletetraceacceptaccept-charsetaccept-encodingaccept-',

1
test/parallel/test-zlib-flush-drain.js

@ -2,7 +2,6 @@
require('../common'); require('../common');
const assert = require('assert'); const assert = require('assert');
const zlib = require('zlib'); const zlib = require('zlib');
const path = require('path');
const bigData = new Buffer(10240).fill('x'); const bigData = new Buffer(10240).fill('x');

1
test/parallel/test-zlib-write-after-flush.js

@ -2,7 +2,6 @@
require('../common'); require('../common');
var assert = require('assert'); var assert = require('assert');
var zlib = require('zlib'); var zlib = require('zlib');
var fs = require('fs');
var gzip = zlib.createGzip(); var gzip = zlib.createGzip();
var gunz = zlib.createUnzip(); var gunz = zlib.createUnzip();

3
test/pummel/test-dtrace-jsstack.js

@ -2,7 +2,6 @@
require('../common'); require('../common');
var assert = require('assert'); var assert = require('assert');
var os = require('os'); var os = require('os');
var util = require('util');
if (os.type() != 'SunOS') { if (os.type() != 'SunOS') {
console.log('1..0 # Skipped: no DTRACE support'); console.log('1..0 # Skipped: no DTRACE support');
@ -13,7 +12,6 @@ if (os.type() != 'SunOS') {
* Some functions to create a recognizable stack. * Some functions to create a recognizable stack.
*/ */
var frames = [ 'stalloogle', 'bagnoogle', 'doogle' ]; var frames = [ 'stalloogle', 'bagnoogle', 'doogle' ];
var expected;
var stalloogle = function(str) { var stalloogle = function(str) {
expected = str; expected = str;
@ -35,7 +33,6 @@ var doogle = function() {
var spawn = require('child_process').spawn; var spawn = require('child_process').spawn;
var prefix = '/var/tmp/node'; 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 * We're going to use DTrace to stop us, gcore us, and set us running again

1
test/pummel/test-http-client-reconnect-bug.js

@ -3,7 +3,6 @@ var common = require('../common');
var assert = require('assert'); var assert = require('assert');
var net = require('net'), var net = require('net'),
util = require('util'),
http = require('http'); http = require('http');
var errorCount = 0; var errorCount = 0;

1
test/pummel/test-keep-alive.js

@ -5,7 +5,6 @@ var common = require('../common');
var assert = require('assert'); var assert = require('assert');
var spawn = require('child_process').spawn; var spawn = require('child_process').spawn;
var http = require('http'); var http = require('http');
var path = require('path');
var url = require('url'); var url = require('url');
if (common.isWindows) { if (common.isWindows) {

3
test/pummel/test-timer-wrap2.js

@ -1,9 +1,8 @@
'use strict'; 'use strict';
require('../common'); require('../common');
var assert = require('assert');
// Test that allocating a timer does not increase the loop's reference // Test that allocating a timer does not increase the loop's reference
// count. // count.
var Timer = process.binding('timer_wrap').Timer; var Timer = process.binding('timer_wrap').Timer;
var t = new Timer(); new Timer();

4
test/pummel/test-tls-securepair-client.js

@ -17,9 +17,7 @@ var join = require('path').join;
var net = require('net'); var net = require('net');
var assert = require('assert'); var assert = require('assert');
var fs = require('fs'); var fs = require('fs');
var crypto = require('crypto');
var tls = require('tls'); var tls = require('tls');
var exec = require('child_process').exec;
var spawn = require('child_process').spawn; var spawn = require('child_process').spawn;
test1(); test1();
@ -47,8 +45,6 @@ function test(keyfn, certfn, check, next) {
// EADDRINUSE. // EADDRINUSE.
var PORT = common.PORT + 5; var PORT = common.PORT + 5;
var connections = 0;
keyfn = join(common.fixturesDir, keyfn); keyfn = join(common.fixturesDir, keyfn);
var key = fs.readFileSync(keyfn).toString(); var key = fs.readFileSync(keyfn).toString();

1
test/sequential/test-child-process-execsync.js

@ -1,7 +1,6 @@
'use strict'; 'use strict';
var common = require('../common'); var common = require('../common');
var assert = require('assert'); var assert = require('assert');
var os = require('os');
var execSync = require('child_process').execSync; var execSync = require('child_process').execSync;
var execFileSync = require('child_process').execFileSync; var execFileSync = require('child_process').execFileSync;

3
test/sequential/test-regress-GH-1697.js

@ -1,8 +1,7 @@
'use strict'; 'use strict';
var common = require('../common'); var common = require('../common');
var net = require('net'), var net = require('net'),
cp = require('child_process'), cp = require('child_process');
util = require('util');
if (process.argv[2] === 'server') { if (process.argv[2] === 'server') {
// Server // Server

1
test/sequential/test-stdout-close-catch.js

@ -3,7 +3,6 @@ var common = require('../common');
var assert = require('assert'); var assert = require('assert');
var path = require('path'); var path = require('path');
var child_process = require('child_process'); var child_process = require('child_process');
var fs = require('fs');
var testScript = path.join(common.fixturesDir, 'catch-stdout-error.js'); var testScript = path.join(common.fixturesDir, 'catch-stdout-error.js');

Loading…
Cancel
Save