Skip to content

Commit

Permalink
test: replace console.error() with debuglog calls
Browse files Browse the repository at this point in the history
Somehow thought I did this in 8905be2
but clearly did not.

PR-URL: #32588
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
  • Loading branch information
Trott authored and targos committed Apr 11, 2020
1 parent 055c568 commit e01d061
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/parallel/test-http-information-processing.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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;
Expand All @@ -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();
Expand Down

0 comments on commit e01d061

Please sign in to comment.