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-
varcommon=require('../common');
2+
constcommon=require('../common');
43
varassert=require('assert');
54
varspawn=require('child_process').spawn;
65

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

99
varchild;

‎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+
constcommon=require('../common');
23
constpath=require('path');
34
constassert=require('assert');
45
constspawn=require('child_process').spawn;
5-
constcommon=require('../common');
66
constdebug=require('_debugger');
77

88
varscenarios=[];

‎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-
varcommon=require('../common');
2+
constcommon=require('../common');
43
varassert=require('assert');
54
vardebug=require('_debugger');
65

6+
process.env.NODE_DEBUGGER_TIMEOUT=2000;
77
vardebugPort=common.PORT;
88
debug.port=debugPort;
99
varspawn=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+
constcommon=require('../common');
1011
varITERATIONS=1000;
1112

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

1616
varbuf=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
functionserverHandler(req,res){
68
res.connection.destroy();
79
}
810

911
consthttp=require('http');
1012
constweak=require('weak');
11-
require('../common');
1213
constassert=require('assert');
1314
consttodo=500;
1415
letdone=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
functionserverHandler(req,res){
68
req.resume();
79
res.writeHead(200,{'Content-Type': 'text/plain'});
@@ -10,7 +12,6 @@ function serverHandler(req, res){
1012

1113
consthttp=require('http');
1214
constweak=require('weak');
13-
require('../common');
1415
constassert=require('assert');
1516
consttodo=500;
1617
letdone=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
functionserverHandler(req,res){
68
setTimeout(function(){
79
req.resume();
@@ -12,7 +14,6 @@ function serverHandler(req, res){
1214

1315
consthttp=require('http');
1416
constweak=require('weak');
15-
require('../common');
1617
constassert=require('assert');
1718
consttodo=550;
1819
letdone=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
functionserverHandler(req,res){
57
res.writeHead(200,{'Content-Type': 'text/plain'});
68
res.end('Hello World\n');
79
}
810

911
consthttp=require('http');
1012
constweak=require('weak');
11-
require('../common');
1213
constassert=require('assert');
1314
consttodo=500;
1415
letdone=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
functionserverHandler(sock){
68
sock.setTimeout(120000);
79
sock.resume();
@@ -19,7 +21,6 @@ function serverHandler(sock){
1921

2022
constnet=require('net');
2123
constweak=require('weak');
22-
require('../common');
2324
constassert=require('assert');
2425
consttodo=500;
2526
letdone=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+
constcommon=require('../common');
23
varassert=require('assert');
3-
varcommon=require('../common');
44
varfork=require('child_process').fork;
55
varnet=require('net');
66

0 commit comments

Comments
(0)