Skip to content

Commit 5ada45b

Browse files
Trottrvagg
authored andcommitted
test: replace deprecated util.debug() calls
common.debug() is just util.debug() and emits a deprecation notice. Per docs, use console.error() instead. PR-URL: #3082 Reviewed-By: Michaël Zasso <[email protected]>
1 parent 6ee5d0f commit 5ada45b

24 files changed

+61
-62
lines changed

test/disabled/test-sendfd.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ var logChild = function(d) {
5252

5353
d.split('\n').forEach(function(l) {
5454
if (l.length > 0) {
55-
common.debug('CHILD: ' + l);
55+
console.error('CHILD: ' + l);
5656
}
5757
});
5858
};

test/parallel/test-file-read-noexist.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ fs.readFile(filename, 'raw', function(err, content) {
1010
if (err) {
1111
got_error = true;
1212
} else {
13-
common.debug('cat returned some content: ' + content);
14-
common.debug('this shouldn\'t happen as the file doesn\'t exist...');
13+
console.error('cat returned some content: ' + content);
14+
console.error('this shouldn\'t happen as the file doesn\'t exist...');
1515
assert.equal(true, false);
1616
}
1717
});

test/parallel/test-fs-realpath.js

-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ function test_deep_symlink_mix(callback) {
326326
[fixturesAbsDir + '/nested-index/two/realpath-c',
327327
'../../../' + common.tmpDirName + '/cycles/root.js']
328328
].forEach(function(t) {
329-
//common.debug('setting up '+t[0]+' -> '+t[1]);
330329
try { fs.unlinkSync(t[0]); } catch (e) {}
331330
fs.symlinkSync(t[1], t[0]);
332331
unlink.push(t[0]);

test/parallel/test-http-after-connect.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var serverRequests = 0;
88
var clientResponses = 0;
99

1010
var server = http.createServer(function(req, res) {
11-
common.debug('Server got GET request');
11+
console.error('Server got GET request');
1212
req.resume();
1313
++serverRequests;
1414
res.writeHead(200);
@@ -18,7 +18,7 @@ var server = http.createServer(function(req, res) {
1818
}, 50);
1919
});
2020
server.on('connect', function(req, socket, firstBodyChunk) {
21-
common.debug('Server got CONNECT request');
21+
console.error('Server got CONNECT request');
2222
serverConnected = true;
2323
socket.write('HTTP/1.1 200 Connection established\r\n\r\n');
2424
socket.resume();
@@ -33,7 +33,7 @@ server.listen(common.PORT, function() {
3333
path: 'google.com:80'
3434
});
3535
req.on('connect', function(res, socket, firstBodyChunk) {
36-
common.debug('Client got CONNECT response');
36+
console.error('Client got CONNECT response');
3737
socket.end();
3838
socket.on('end', function() {
3939
doRequest(0);
@@ -49,7 +49,7 @@ function doRequest(i) {
4949
port: common.PORT,
5050
path: '/request' + i
5151
}, function(res) {
52-
common.debug('Client got GET response');
52+
console.error('Client got GET response');
5353
var data = '';
5454
res.setEncoding('utf8');
5555
res.on('data', function(chunk) {

test/parallel/test-http-connect.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var server = http.createServer(function(req, res) {
1212
server.on('connect', function(req, socket, firstBodyChunk) {
1313
assert.equal(req.method, 'CONNECT');
1414
assert.equal(req.url, 'google.com:443');
15-
common.debug('Server got CONNECT request');
15+
console.error('Server got CONNECT request');
1616
serverGotConnect = true;
1717

1818
socket.write('HTTP/1.1 200 Connection established\r\n\r\n');
@@ -40,7 +40,7 @@ server.listen(common.PORT, function() {
4040
});
4141

4242
req.on('connect', function(res, socket, firstBodyChunk) {
43-
common.debug('Client got CONNECT request');
43+
console.error('Client got CONNECT request');
4444
clientGotConnect = true;
4545

4646
// Make sure this request got removed from the pool.

test/parallel/test-http-expect-continue.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var got_continue = false;
1111

1212
function handler(req, res) {
1313
assert.equal(sent_continue, true, 'Full response sent before 100 Continue');
14-
common.debug('Server sending full response...');
14+
console.error('Server sending full response...');
1515
res.writeHead(200, {
1616
'Content-Type' : 'text/plain',
1717
'ABCD' : '1'
@@ -21,7 +21,7 @@ function handler(req, res) {
2121

2222
var server = http.createServer(handler);
2323
server.on('checkContinue', function(req, res) {
24-
common.debug('Server got Expect: 100-continue...');
24+
console.error('Server got Expect: 100-continue...');
2525
res.writeContinue();
2626
sent_continue = true;
2727
setTimeout(function() {
@@ -38,11 +38,11 @@ server.on('listening', function() {
3838
path: '/world',
3939
headers: { 'Expect': '100-continue' }
4040
});
41-
common.debug('Client sending request...');
41+
console.error('Client sending request...');
4242
outstanding_reqs++;
4343
var body = '';
4444
req.on('continue', function() {
45-
common.debug('Client got 100 Continue...');
45+
console.error('Client got 100 Continue...');
4646
got_continue = true;
4747
req.end(test_req_body);
4848
});
@@ -54,7 +54,7 @@ server.on('listening', function() {
5454
res.setEncoding('utf8');
5555
res.on('data', function(chunk) { body += chunk; });
5656
res.on('end', function() {
57-
common.debug('Got full response.');
57+
console.error('Got full response.');
5858
assert.equal(body, test_res_body, 'Response body doesn\'t match.');
5959
assert.ok('abcd' in res.headers, 'Response headers missing.');
6060
outstanding_reqs--;

test/parallel/test-http-legacy.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ server.listen(common.PORT, function() {
5454
responses_recvd += 1;
5555
res.setEncoding('utf8');
5656
res.on('data', function(chunk) { body0 += chunk; });
57-
common.debug('Got /hello response');
57+
console.error('Got /hello response');
5858
});
5959

6060
setTimeout(function() {
@@ -65,16 +65,16 @@ server.listen(common.PORT, function() {
6565
responses_recvd += 1;
6666
res.setEncoding('utf8');
6767
res.on('data', function(chunk) { body1 += chunk; });
68-
common.debug('Got /world response');
68+
console.error('Got /world response');
6969
});
7070
}, 1);
7171
});
7272

7373
process.on('exit', function() {
74-
common.debug('responses_recvd: ' + responses_recvd);
74+
console.error('responses_recvd: ' + responses_recvd);
7575
assert.equal(2, responses_recvd);
7676

77-
common.debug('responses_sent: ' + responses_sent);
77+
console.error('responses_sent: ' + responses_sent);
7878
assert.equal(2, responses_sent);
7979

8080
assert.equal('The path was /hello', body0);

test/parallel/test-http-pause.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ var expectedClient = 'Response Body from Server';
99
var resultClient = '';
1010

1111
var server = http.createServer(function(req, res) {
12-
common.debug('pause server request');
12+
console.error('pause server request');
1313
req.pause();
1414
setTimeout(function() {
15-
common.debug('resume server request');
15+
console.error('resume server request');
1616
req.resume();
1717
req.setEncoding('utf8');
1818
req.on('data', function(chunk) {
1919
resultServer += chunk;
2020
});
2121
req.on('end', function() {
22-
common.debug(resultServer);
22+
console.error(resultServer);
2323
res.writeHead(200);
2424
res.end(expectedClient);
2525
});
@@ -32,16 +32,16 @@ server.listen(common.PORT, function() {
3232
path: '/',
3333
method: 'POST'
3434
}, function(res) {
35-
common.debug('pause client response');
35+
console.error('pause client response');
3636
res.pause();
3737
setTimeout(function() {
38-
common.debug('resume client response');
38+
console.error('resume client response');
3939
res.resume();
4040
res.on('data', function(chunk) {
4141
resultClient += chunk;
4242
});
4343
res.on('end', function() {
44-
common.debug(resultClient);
44+
console.error(resultClient);
4545
server.close();
4646
});
4747
}, 100);

test/parallel/test-http-pipe-fs.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ var server = http.createServer(function(req, res) {
3131
}
3232
}, function(res) {
3333
res.on('end', function() {
34-
common.debug('res' + i + ' end');
34+
console.error('res' + i + ' end');
3535
if (i === 2) {
3636
server.close();
3737
}
3838
});
3939
res.resume();
4040
});
4141
req.on('socket', function(s) {
42-
common.debug('req' + i + ' start');
42+
console.error('req' + i + ' start');
4343
});
4444
req.end('12345');
4545
}(i + 1));

test/parallel/test-http-set-timeout.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var server = http.createServer(function(req, res) {
1010
assert.ok(s instanceof net.Socket);
1111
req.connection.on('timeout', function() {
1212
req.connection.destroy();
13-
common.debug('TIMEOUT');
13+
console.error('TIMEOUT');
1414
server.close();
1515
});
1616
});

test/parallel/test-http.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ server.on('listening', function() {
5656
responses_recvd += 1;
5757
res.setEncoding('utf8');
5858
res.on('data', function(chunk) { body0 += chunk; });
59-
common.debug('Got /hello response');
59+
console.error('Got /hello response');
6060
});
6161

6262
setTimeout(function() {
@@ -70,17 +70,17 @@ server.on('listening', function() {
7070
responses_recvd += 1;
7171
res.setEncoding('utf8');
7272
res.on('data', function(chunk) { body1 += chunk; });
73-
common.debug('Got /world response');
73+
console.error('Got /world response');
7474
});
7575
req.end();
7676
}, 1);
7777
});
7878

7979
process.on('exit', function() {
80-
common.debug('responses_recvd: ' + responses_recvd);
80+
console.error('responses_recvd: ' + responses_recvd);
8181
assert.equal(2, responses_recvd);
8282

83-
common.debug('responses_sent: ' + responses_sent);
83+
console.error('responses_sent: ' + responses_sent);
8484
assert.equal(2, responses_sent);
8585

8686
assert.equal('The path was /hello', body0);

test/parallel/test-https-drain.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ server.listen(common.PORT, function() {
3434
}, function(res) {
3535
var timer;
3636
res.pause();
37-
common.debug('paused');
37+
console.error('paused');
3838
send();
3939
function send() {
4040
if (req.write(new Buffer(bufSize))) {
@@ -43,10 +43,10 @@ server.listen(common.PORT, function() {
4343
return process.nextTick(send);
4444
}
4545
sent += bufSize;
46-
common.debug('sent: ' + sent);
46+
console.error('sent: ' + sent);
4747
resumed = true;
4848
res.resume();
49-
common.debug('resumed');
49+
console.error('resumed');
5050
timer = setTimeout(function() {
5151
process.exit(1);
5252
}, 1000);
@@ -60,7 +60,7 @@ server.listen(common.PORT, function() {
6060
}
6161
received += data.length;
6262
if (received >= sent) {
63-
common.debug('received: ' + received);
63+
console.error('received: ' + received);
6464
req.end();
6565
server.close();
6666
}

test/parallel/test-module-loading-error.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
var common = require('../common');
33
var assert = require('assert');
44

5-
common.debug('load test-module-loading-error.js');
5+
console.error('load test-module-loading-error.js');
66

77
var error_desc = {
88
win32: '%1 is not a valid Win32 application',

test/parallel/test-net-listen-close-server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ server.listen(common.PORT, function() {
1010
assert(false);
1111
});
1212
server.on('error', function(error) {
13-
common.debug(error);
13+
console.error(error);
1414
assert(false);
1515
});
1616
server.close();

test/parallel/test-net-listen-error.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ server.listen(1, '1.1.1.1', function() { // EACCESS or EADDRNOTAVAIL
1010
assert(false);
1111
});
1212
server.on('error', function(error) {
13-
common.debug(error);
13+
console.error(error);
1414
gotError = true;
1515
});
1616

test/parallel/test-tls-client-reject.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var connectCount = 0;
2121
var server = tls.createServer(options, function(socket) {
2222
++connectCount;
2323
socket.on('data', function(data) {
24-
common.debug(data.toString());
24+
console.error(data.toString());
2525
assert.equal(data, 'ok');
2626
});
2727
}).listen(common.PORT, function() {
@@ -51,7 +51,7 @@ function rejectUnauthorized() {
5151
assert(false);
5252
});
5353
socket.on('error', function(err) {
54-
common.debug(err);
54+
console.error(err);
5555
authorized();
5656
});
5757
socket.write('ng');

test/parallel/test-tls-pause.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ server.listen(common.PORT, function() {
3535
}, function() {
3636
console.error('connected');
3737
client.pause();
38-
common.debug('paused');
38+
console.error('paused');
3939
send();
4040
function send() {
4141
console.error('sending');
@@ -48,7 +48,7 @@ server.listen(common.PORT, function() {
4848
return process.nextTick(send);
4949
}
5050
sent += bufSize;
51-
common.debug('sent: ' + sent);
51+
console.error('sent: ' + sent);
5252
resumed = true;
5353
client.resume();
5454
console.error('resumed', client);
@@ -61,7 +61,7 @@ server.listen(common.PORT, function() {
6161
console.error('received', received);
6262
console.error('sent', sent);
6363
if (received >= sent) {
64-
common.debug('received: ' + received);
64+
console.error('received: ' + received);
6565
client.end();
6666
server.close();
6767
}

test/parallel/test-tls-peer-certificate-encoding.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ server.listen(common.PORT, function() {
3030
}, function() {
3131
var peerCert = socket.getPeerCertificate();
3232

33-
common.debug(util.inspect(peerCert));
33+
console.error(util.inspect(peerCert));
3434
assert.equal(peerCert.subject.CN, 'Ádám Lippai');
3535
verified = true;
3636
server.close();

test/parallel/test-tls-peer-certificate-multi-keys.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ server.listen(common.PORT, function() {
2828
rejectUnauthorized: false
2929
}, function() {
3030
var peerCert = socket.getPeerCertificate();
31-
common.debug(util.inspect(peerCert));
31+
console.error(util.inspect(peerCert));
3232
assert.deepEqual(peerCert.subject.OU,
3333
['Information Technology', 'Engineering', 'Marketing']);
3434
verified = true;

test/parallel/test-tls-peer-certificate.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ server.listen(common.PORT, function() {
3535
peerCert = socket.getPeerCertificate(true);
3636
assert.ok(peerCert.issuerCertificate);
3737

38-
common.debug(util.inspect(peerCert));
38+
console.error(util.inspect(peerCert));
3939
assert.equal(peerCert.subject.emailAddress, '[email protected]');
4040
assert.equal(peerCert.serialNumber, '9A84ABCFB8A72AC0');
4141
assert.equal(peerCert.exponent, '0x10001');

test/pummel/test-net-pause.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@ server.listen(common.PORT);
6565

6666
process.on('exit', function() {
6767
assert.equal(N, recv.length);
68-
common.debug('Exit');
68+
console.error('Exit');
6969
});

0 commit comments

Comments
 (0)