mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
test: replace console.error() with debuglog calls
Somehow thought I did this in 8905be2cee
but clearly did not.
PR-URL: https://github.com/nodejs/node/pull/32588
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
This commit is contained in:
1 parent
e629366fc6
commit
83ebd77318
1 file changed
+5
-4
@@ -2,16 +2,17 @@
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
const http = require('http');
|
||||
const debug = require('util').debuglog('test');
|
||||
|
||||
const testResBody = 'other stuff!\n';
|
||||
const kMessageCount = 2;
|
||||
|
||||
const server = http.createServer((req, res) => {
|
||||
for (let i = 0; i < kMessageCount; i++) {
|
||||
console.error(`Server sending informational message #${i}...`);
|
||||
debug(`Server sending informational message #${i}...`);
|
||||
res.writeProcessing();
|
||||
}
|
||||
console.error('Server sending full response...');
|
||||
debug('Server sending full response...');
|
||||
res.writeHead(200, {
|
||||
'Content-Type': 'text/plain',
|
||||
'ABCD': '1'
|
||||
@@ -25,7 +26,7 @@ server.listen(0, function() {
|
||||
path: '/world'
|
||||
});
|
||||
req.end();
|
||||
console.error('Client sending request...');
|
||||
debug('Client sending request...');
|
||||
|
||||
let body = '';
|
||||
let infoCount = 0;
|
||||
@@ -40,7 +41,7 @@ server.listen(0, function() {
|
||||
res.setEncoding('utf8');
|
||||
res.on('data', function(chunk) { body += chunk; });
|
||||
res.on('end', function() {
|
||||
console.error('Got full response.');
|
||||
debug('Got full response.');
|
||||
assert.strictEqual(body, testResBody);
|
||||
assert.ok('abcd' in res.headers);
|
||||
server.close();
|
||||
|
||||
Reference in new issue
Block a user