Skip to content

Commit 1ab6df6

Browse files
thefourtheyeevanlucas
authored andcommitted
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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 6e6cf36 commit 1ab6df6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+94
-97
lines changed

test/debugger/helper-debugger-repl.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
'use strict';
2-
process.env.NODE_DEBUGGER_TIMEOUT = 2000;
3-
var common = require('../common');
2+
const common = require('../common');
43
var assert = require('assert');
54
var spawn = require('child_process').spawn;
65

6+
process.env.NODE_DEBUGGER_TIMEOUT = 2000;
77
var port = common.PORT;
88

99
var child;

test/debugger/test-debug-break-on-uncaught.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
2+
const common = require('../common');
23
const path = require('path');
34
const assert = require('assert');
45
const spawn = require('child_process').spawn;
5-
const common = require('../common');
66
const debug = require('_debugger');
77

88
var scenarios = [];

test/debugger/test-debugger-client.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
'use strict';
2-
process.env.NODE_DEBUGGER_TIMEOUT = 2000;
3-
var common = require('../common');
2+
const common = require('../common');
43
var assert = require('assert');
54
var debug = require('_debugger');
65

6+
process.env.NODE_DEBUGGER_TIMEOUT = 2000;
77
var debugPort = common.PORT;
88
debug.port = debugPort;
99
var spawn = require('child_process').spawn;

test/disabled/test-dgram-send-error.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
// we also send packets to ourselves to verify that after receiving an error
88
// we can still receive packets successfully.
99

10+
const common = require('../common');
1011
var ITERATIONS = 1000;
1112

1213
var assert = require('assert'),
13-
common = require('../common'),
1414
dgram = require('dgram');
1515

1616
var buf = Buffer.alloc(1024, 42);

test/gc/test-http-client-connaborted.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
// just like test/gc/http-client.js,
33
// but aborting every connection that comes in.
44

5+
require('../common');
6+
57
function serverHandler(req, res) {
68
res.connection.destroy();
79
}
810

911
const http = require('http');
1012
const weak = require('weak');
11-
require('../common');
1213
const assert = require('assert');
1314
const todo = 500;
1415
let done = 0;

test/gc/test-http-client-onerror.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// just like test/gc/http-client.js,
33
// but with an on('error') handler that does nothing.
44

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

1113
const http = require('http');
1214
const weak = require('weak');
13-
require('../common');
1415
const assert = require('assert');
1516
const todo = 500;
1617
let done = 0;

test/gc/test-http-client-timeout.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// just like test/gc/http-client.js,
33
// but with a timeout set
44

5+
require('../common');
6+
57
function serverHandler(req, res) {
68
setTimeout(function() {
79
req.resume();
@@ -12,7 +14,6 @@ function serverHandler(req, res) {
1214

1315
const http = require('http');
1416
const weak = require('weak');
15-
require('../common');
1617
const assert = require('assert');
1718
const todo = 550;
1819
let done = 0;

test/gc/test-http-client.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
'use strict';
22
// just a simple http server and client.
33

4+
require('../common');
5+
46
function serverHandler(req, res) {
57
res.writeHead(200, {'Content-Type': 'text/plain'});
68
res.end('Hello World\n');
79
}
810

911
const http = require('http');
1012
const weak = require('weak');
11-
require('../common');
1213
const assert = require('assert');
1314
const todo = 500;
1415
let done = 0;

test/gc/test-net-timeout.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// just like test/gc/http-client-timeout.js,
33
// but using a net server/client instead
44

5+
require('../common');
6+
57
function serverHandler(sock) {
68
sock.setTimeout(120000);
79
sock.resume();
@@ -19,7 +21,6 @@ function serverHandler(sock) {
1921

2022
const net = require('net');
2123
const weak = require('weak');
22-
require('../common');
2324
const assert = require('assert');
2425
const todo = 500;
2526
let done = 0;

test/parallel/test-child-process-disconnect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
2+
const common = require('../common');
23
var assert = require('assert');
3-
var common = require('../common');
44
var fork = require('child_process').fork;
55
var net = require('net');
66

0 commit comments

Comments
 (0)