Skip to content

Commit

Permalink
test: remove unnecessary assignments
Browse files Browse the repository at this point in the history
common.js needs to be loaded in all tests so that there is checking
for variable leaks and possibly other things. However, it does not
need to be assigned to a variable if nothing in common.js is referred
to elsewhere in the test.

The main tradeoff for this bit of code churn is that it gets the code
base most of the way to being able to enable the no-unused-vars rule in
eslint.

(The non-tooling benefit is that it lessens cognitive load when reading
tests as it is an immediate indication that none of the functions or
properties in common.js will be used by the test.)

PR-URL: #4563
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
  • Loading branch information
Trott authored and Myles Borins committed Jan 19, 2016
1 parent 41882e4 commit d795301
Show file tree
Hide file tree
Showing 307 changed files with 316 additions and 317 deletions.
2 changes: 1 addition & 1 deletion test/internet/test-dns-txt-sigsegv.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var dns = require('dns');

Expand Down
2 changes: 1 addition & 1 deletion test/internet/test-dns.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert'),
dns = require('dns'),
net = require('net'),
Expand Down
2 changes: 1 addition & 1 deletion test/internet/test-http-dns-fail.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* should trigger the error event after each attempt.
*/

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

Expand Down
2 changes: 1 addition & 1 deletion test/internet/test-net-connect-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// https://groups.google.com/forum/#!topic/nodejs/UE0ZbfLt6t8
// https://groups.google.com/forum/#!topic/nodejs-dev/jR7-5UDqXkw

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

Expand Down
2 changes: 1 addition & 1 deletion test/internet/test-net-connect-unref.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var net = require('net');

Expand Down
2 changes: 1 addition & 1 deletion test/message/2100bytes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var util = require('util');

Expand Down
2 changes: 1 addition & 1 deletion test/message/core_line_numbers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const common = require('../common');
require('../common');
const punycode = require('punycode');

// This test verifies that line numbers in core modules are reported correctly.
Expand Down
2 changes: 1 addition & 1 deletion test/message/error_exit.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');

process.on('exit', function(code) {
Expand Down
2 changes: 1 addition & 1 deletion test/message/eval_messages.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

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

var spawn = require('child_process').spawn;
Expand Down
2 changes: 1 addition & 1 deletion test/message/hello_world.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');

console.log('hello world');
2 changes: 1 addition & 1 deletion test/message/max_tick_depth.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');

process.maxTickDepth = 10;
var i = 20;
Expand Down
2 changes: 1 addition & 1 deletion test/message/nexttick_throw.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');

process.nextTick(function() {
Expand Down
2 changes: 1 addition & 1 deletion test/message/stack_overflow.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');

Error.stackTraceLimit = 0;
Expand Down
2 changes: 1 addition & 1 deletion test/message/stdin_messages.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

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

var spawn = require('child_process').spawn;
Expand Down
2 changes: 1 addition & 1 deletion test/message/throw_custom_error.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');

// custom error throwing
Expand Down
2 changes: 1 addition & 1 deletion test/message/throw_in_line_with_tabs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable indent */
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');

console.error('before');
Expand Down
2 changes: 1 addition & 1 deletion test/message/throw_non_error.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');

// custom error throwing
Expand Down
2 changes: 1 addition & 1 deletion test/message/throw_null.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');

throw null;
2 changes: 1 addition & 1 deletion test/message/throw_undefined.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');

throw undefined;
2 changes: 1 addition & 1 deletion test/message/timeout_throw.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');

setTimeout(function() {
Expand Down
2 changes: 1 addition & 1 deletion test/message/undefined_reference_in_new_context.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var vm = require('vm');

Expand Down
2 changes: 1 addition & 1 deletion test/message/vm_display_runtime_error.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var vm = require('vm');

Expand Down
2 changes: 1 addition & 1 deletion test/message/vm_dont_display_syntax_error.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var vm = require('vm');

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-async-wrap-throw-no-init.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const common = require('../common');
require('../common');
const assert = require('assert');
const async_wrap = process.binding('async_wrap');

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-buffer-arraybuffer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

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

const Buffer = require('buffer').Buffer;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-buffer-ascii.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');

// ASCII conversion in node.js simply masks off the high bits,
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-buffer-bytelength.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var common = require('../common');
require('../common');
var assert = require('assert');
var Buffer = require('buffer').Buffer;

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-buffer-concat.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');

var zero = [];
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-buffer-fakes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const common = require('../common');
require('../common');
const assert = require('assert');
const Buffer = require('buffer').Buffer;
const Bp = Buffer.prototype;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-buffer-indexof.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');

var Buffer = require('buffer').Buffer;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-buffer-inheritance.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

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


Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-buffer-inspect.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');

var util = require('util');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-buffer-iterator.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');

var buffer = new Buffer([1, 2, 3, 4, 5]);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-buffer-slow.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const common = require('../common');
require('../common');
const assert = require('assert');
const buffer = require('buffer');
const Buffer = buffer.Buffer;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-constructor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

require('../common');
var assert = require('assert');
var common = require('../common');
var child_process = require('child_process');
var ChildProcess = child_process.ChildProcess;
assert.equal(typeof ChildProcess, 'function');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-detached.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var path = require('path');

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-fork-and-spawn.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var spawn = require('child_process').spawn;
var fork = require('child_process').fork;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-fork-ref.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var fork = require('child_process').fork;

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-fork-ref2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var fork = require('child_process').fork;

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-internal.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');

//messages
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-set-blocking.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var ch = require('child_process');

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-silent.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var childProcess = require('child_process');

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-spawnsync-env.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var cp = require('child_process');

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-spawnsync-timeout.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');

var spawnSync = require('child_process').spawnSync;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-stdin-ipc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');

var spawn = require('child_process').spawn;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-stdio-big-write-end.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var BUFSIZE = 1024;

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-validate-stdio.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';
// Flags: --expose_internals

require('../common');
var assert = require('assert');
var common = require('../common');
var _validateStdio = require('internal/child_process')._validateStdio;

// should throw if string and not ignore, pipe, or inherit
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-cluster-debug-port.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const common = require('../common');
require('../common');
const assert = require('assert');
const cluster = require('cluster');

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-cluster-fork-env.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var cluster = require('cluster');

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-cluster-setup-master-cumulative.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var cluster = require('cluster');

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-cluster-setup-master-emit.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var cluster = require('cluster');

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-cluster-setup-master-multiple.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var cluster = require('cluster');

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-cluster-setup-master.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var cluster = require('cluster');

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-cluster-uncaught-exception.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// one that the cluster module installs.
// https://github.com/joyent/node/issues/2556

var common = require('../common');
require('../common');
var assert = require('assert');
var cluster = require('cluster');
var fork = require('child_process').fork;
Expand Down
Loading

0 comments on commit d795301

Please sign in to comment.