Skip to content
Permalink
Browse files

test: make import common as the first line

The `test/common` module has the capability to identify if any variable
is leaked to the global scope and fail the test. So that has to be
imported at the beginning.

PR-URL: #7786
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information...
thefourtheye authored and Trott committed Jul 18, 2016
1 parent c21a212 commit 612307564b2f7758ad4436f95b03c05dca1198d7
Showing with 94 additions and 97 deletions.
  1. +2 −2 test/debugger/helper-debugger-repl.js
  2. +1 −1 test/debugger/test-debug-break-on-uncaught.js
  3. +2 −2 test/debugger/test-debugger-client.js
  4. +1 −1 test/disabled/test-dgram-send-error.js
  5. +2 −1 test/gc/test-http-client-connaborted.js
  6. +2 −1 test/gc/test-http-client-onerror.js
  7. +2 −1 test/gc/test-http-client-timeout.js
  8. +2 −1 test/gc/test-http-client.js
  9. +2 −1 test/gc/test-net-timeout.js
  10. +1 −1 test/parallel/test-child-process-disconnect.js
  11. +1 −1 test/parallel/test-child-process-flush-stdio.js
  12. +1 −1 test/parallel/test-child-process-fork-close.js
  13. +1 −1 test/parallel/test-child-process-fork-dgram.js
  14. +1 −1 test/parallel/test-child-process-fork-exec-path.js
  15. +1 −1 test/parallel/test-child-process-fork-net2.js
  16. +1 −1 test/parallel/test-child-process-spawn-typeerror.js
  17. +1 −2 test/parallel/test-cli-syntax.js
  18. +1 −1 test/parallel/test-cluster-dgram-1.js
  19. +1 −1 test/parallel/test-cluster-dgram-2.js
  20. +1 −1 test/parallel/test-cluster-worker-no-exit.js
  21. +1 −3 test/parallel/test-debugger-repeat-last.js
  22. +1 −2 test/parallel/test-debugger-util-regression.js
  23. +1 −1 test/parallel/test-domain-with-abort-on-uncaught-exception.js
  24. +1 −3 test/parallel/test-fs-read-stream-fd.js
  25. +1 −1 test/parallel/test-fs-readfile-unlink.js
  26. +1 −1 test/parallel/test-https-client-get-url.js
  27. +1 −2 test/parallel/test-https-req-split.js
  28. +1 −1 test/parallel/test-https-strict.js
  29. +1 −1 test/parallel/test-path-makelong.js
  30. +1 −1 test/parallel/test-process-env.js
  31. +1 −1 test/parallel/test-process-no-deprecation.js
  32. +1 −1 test/parallel/test-regress-GH-1899.js
  33. +1 −1 test/parallel/test-repl-.save.load.js
  34. +1 −1 test/parallel/test-repl-timeout-throw.js
  35. +1 −1 test/parallel/test-setproctitle.js
  36. +1 −1 test/parallel/test-tick-processor.js
  37. +1 −1 test/parallel/test-timers-blocking-callback.js
  38. +1 −1 test/parallel/test-timers-nested.js
  39. +1 −1 test/parallel/test-tls-client-default-ciphers.js
  40. +1 −1 test/parallel/test-tls-close-error.js
  41. +2 −1 test/parallel/test-tls-empty-sni-context.js
  42. +1 −1 test/parallel/test-tls-handshake-error.js
  43. +1 −1 test/pummel/test-abort-fatal-error.js
  44. +2 −2 test/pummel/test-regress-GH-814.js
  45. +1 −1 test/sequential/test-child-process-fork-getconnections.js
  46. +40 −42 test/sequential/test-init.js
@@ -1,9 +1,9 @@
'use strict';
process.env.NODE_DEBUGGER_TIMEOUT = 2000;
var common = require('../common');
const common = require('../common');
var assert = require('assert');
var spawn = require('child_process').spawn;

process.env.NODE_DEBUGGER_TIMEOUT = 2000;
var port = common.PORT;

var child;
@@ -1,8 +1,8 @@
'use strict';
const common = require('../common');
const path = require('path');
const assert = require('assert');
const spawn = require('child_process').spawn;
const common = require('../common');
const debug = require('_debugger');

var scenarios = [];
@@ -1,9 +1,9 @@
'use strict';
process.env.NODE_DEBUGGER_TIMEOUT = 2000;
var common = require('../common');
const common = require('../common');
var assert = require('assert');
var debug = require('_debugger');

process.env.NODE_DEBUGGER_TIMEOUT = 2000;
var debugPort = common.PORT;
debug.port = debugPort;
var spawn = require('child_process').spawn;
@@ -7,10 +7,10 @@
// we also send packets to ourselves to verify that after receiving an error
// we can still receive packets successfully.

const common = require('../common');
var ITERATIONS = 1000;

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

var buf = Buffer.alloc(1024, 42);
@@ -2,13 +2,14 @@
// just like test/gc/http-client.js,
// but aborting every connection that comes in.

require('../common');

function serverHandler(req, res) {
res.connection.destroy();
}

const http = require('http');
const weak = require('weak');
require('../common');
const assert = require('assert');
const todo = 500;
let done = 0;
@@ -2,6 +2,8 @@
// just like test/gc/http-client.js,
// but with an on('error') handler that does nothing.

require('../common');

function serverHandler(req, res) {
req.resume();
res.writeHead(200, {'Content-Type': 'text/plain'});
@@ -10,7 +12,6 @@ function serverHandler(req, res) {

const http = require('http');
const weak = require('weak');
require('../common');
const assert = require('assert');
const todo = 500;
let done = 0;
@@ -2,6 +2,8 @@
// just like test/gc/http-client.js,
// but with a timeout set

require('../common');

function serverHandler(req, res) {
setTimeout(function() {
req.resume();
@@ -12,7 +14,6 @@ function serverHandler(req, res) {

const http = require('http');
const weak = require('weak');
require('../common');
const assert = require('assert');
const todo = 550;
let done = 0;
@@ -1,14 +1,15 @@
'use strict';
// just a simple http server and client.

require('../common');

function serverHandler(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}

const http = require('http');
const weak = require('weak');
require('../common');
const assert = require('assert');
const todo = 500;
let done = 0;
@@ -2,6 +2,8 @@
// just like test/gc/http-client-timeout.js,
// but using a net server/client instead

require('../common');

function serverHandler(sock) {
sock.setTimeout(120000);
sock.resume();
@@ -19,7 +21,6 @@ function serverHandler(sock) {

const net = require('net');
const weak = require('weak');
require('../common');
const assert = require('assert');
const todo = 500;
let done = 0;
@@ -1,6 +1,6 @@
'use strict';
const common = require('../common');
var assert = require('assert');
var common = require('../common');
var fork = require('child_process').fork;
var net = require('net');

@@ -1,6 +1,6 @@
'use strict';
const cp = require('child_process');
const common = require('../common');
const cp = require('child_process');
const assert = require('assert');

// Windows' `echo` command is a built-in shell command and not an external
@@ -1,6 +1,6 @@
'use strict';
const assert = require('assert');
const common = require('../common');
const assert = require('assert');
const fork = require('child_process').fork;

var cp = fork(common.fixturesDir + '/child-process-message-and-exit.js');
@@ -13,10 +13,10 @@
* and the test will fail.
*/

const common = require('../common');
var dgram = require('dgram');
var fork = require('child_process').fork;
var assert = require('assert');
var common = require('../common');

if (common.isWindows) {
common.skip('Sending dgram sockets to child processes is ' +
@@ -1,8 +1,8 @@
'use strict';
const common = require('../common');
var assert = require('assert');
var fs = require('fs');
var path = require('path');
var common = require('../common');
var msg = {test: 'this'};
var nodePath = process.execPath;
var copyPath = path.join(common.tmpDir, 'node-copy.exe');
@@ -1,6 +1,6 @@
'use strict';
const common = require('../common');
var assert = require('assert');
var common = require('../common');
var fork = require('child_process').fork;
var net = require('net');
var count = 12;
@@ -1,10 +1,10 @@
'use strict';
const common = require('../common');
const assert = require('assert');
const child_process = require('child_process');
const spawn = child_process.spawn;
const fork = child_process.fork;
const execFile = child_process.execFile;
const common = require('../common');
const cmd = common.isWindows ? 'rundll32' : 'ls';
const invalidcmd = 'hopefully_you_dont_have_this_on_your_machine';
const invalidArgsMsg = /Incorrect value of args option/;
@@ -1,11 +1,10 @@
'use strict';

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

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

var node = process.execPath;

// test both sets of arguments that check syntax
@@ -1,10 +1,10 @@
'use strict';
const common = require('../common');
var NUM_WORKERS = 4;
var PACKETS_PER_WORKER = 10;

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


@@ -1,9 +1,9 @@
'use strict';
const common = require('../common');
var NUM_WORKERS = 4;
var PACKETS_PER_WORKER = 10;

var cluster = require('cluster');
var common = require('../common');
var dgram = require('dgram');


@@ -1,8 +1,8 @@
'use strict';
const common = require('../common');
var assert = require('assert');
var cluster = require('cluster');
var net = require('net');
var common = require('../common');

var destroyed;
var success;
@@ -1,10 +1,8 @@
'use strict';
const common = require('../common');
const path = require('path');
const spawn = require('child_process').spawn;
const assert = require('assert');

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

const fixture = path.join(
common.fixturesDir,
'debugger-repeat-last.js'
@@ -1,10 +1,9 @@
'use strict';
const common = require('../common');
const path = require('path');
const spawn = require('child_process').spawn;
const assert = require('assert');

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

const fixture = path.join(
common.fixturesDir,
'debugger-util-regression-fixture.js'
@@ -1,8 +1,8 @@
'use strict';

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

/*
* The goal of this test is to make sure that:
@@ -1,10 +1,8 @@
'use strict';
const common = require('../common');
var fs = require('fs');
var assert = require('assert');
var path = require('path');

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

var file = path.join(common.tmpDir, '/read_stream_fd_test.txt');
var input = 'hello world';
var output = '';
@@ -1,6 +1,6 @@
'use strict';
const assert = require('assert');
const common = require('../common');
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const dirName = path.resolve(common.fixturesDir, 'test-readfile-unlink');
@@ -1,8 +1,8 @@
'use strict';
const common = require('../common');
// disable strict server certificate validation by the client
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

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

if (!common.hasCrypto) {
@@ -1,9 +1,8 @@
'use strict';
const common = require('../common');
// disable strict server certificate validation by the client
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

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

if (!common.hasCrypto) {
common.skip('missing crypto');
return;
@@ -1,8 +1,8 @@
'use strict';
const common = require('../common');
// disable strict server certificate validation by the client
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

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

if (!common.hasCrypto) {
@@ -1,7 +1,7 @@
'use strict';
const common = require('../common');
var assert = require('assert');
var path = require('path');
var common = require('../common');

if (common.isWindows) {
var file = path.join(common.fixturesDir, 'a.js');
@@ -1,10 +1,10 @@
'use strict';
/* eslint-disable max-len */

require('../common');
// first things first, set the timezone; see tzset(3)
process.env.TZ = 'Europe/Amsterdam';

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

@@ -4,9 +4,9 @@
// The --no-warnings flag only supresses writing the warning to stderr, not the
// emission of the corresponding event. This test file can be run without it.

const common = require('../common');
process.noDeprecation = true;

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

function listener() {
@@ -1,8 +1,8 @@
'use strict';
const common = require('../common');
var path = require('path');
var assert = require('assert');
var spawn = require('child_process').spawn;
var common = require('../common');

var child = spawn(process.argv[0], [
path.join(common.fixturesDir, 'GH-1899-output.js')
@@ -1,8 +1,8 @@
'use strict';
const common = require('../common');
var assert = require('assert');
var join = require('path').join;
var fs = require('fs');
var common = require('../common');

common.refreshTmpDir();

@@ -1,6 +1,6 @@
'use strict';
const common = require('../common');
var assert = require('assert');
var common = require('../common');

var spawn = require('child_process').spawn;

Oops, something went wrong.

0 comments on commit 6123075

Please sign in to comment.
You can’t perform that action at this time.