Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: improve to use template string #17895

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions test/parallel/test-child-process-fork-net2.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ if (process.argv[2] === 'child') {
process.on('message', function(m, socket) {
if (!socket) return;

console.error('[%d] got socket', id, m);
console.error(`[${id}] got socket ${m}`);

// will call .end('end') or .write('write');
socket[m](m);

socket.resume();

socket.on('data', function() {
console.error('[%d] socket.data', id, m);
console.error(`[${id}] socket.data ${m}`);
});

socket.on('end', function() {
console.error('[%d] socket.end', id, m);
console.error(`[${id}] socket.end ${m}`);
});

// store the unfinished socket
Expand All @@ -54,27 +54,27 @@ if (process.argv[2] === 'child') {
}

socket.on('close', function(had_error) {
console.error('[%d] socket.close', id, had_error, m);
console.error(`[${id}] socket.close ${had_error} ${m}`);
});

socket.on('finish', function() {
console.error('[%d] socket finished', id, m);
console.error(`[${id}] socket finished ${m}`);
});
});

process.on('message', function(m) {
if (m !== 'close') return;
console.error('[%d] got close message', id);
console.error(`[${id}] got close message`);
needEnd.forEach(function(endMe, i) {
console.error('[%d] ending %d/%d', id, i, needEnd.length);
console.error(`[${id}] ending ${i}/${needEnd.length}`);
endMe.end('end');
});
});

process.on('disconnect', function() {
console.error('[%d] process disconnect, ending', id);
console.error(`[${id}] process disconnect, ending`);
needEnd.forEach(function(endMe, i) {
console.error('[%d] ending %d/%d', id, i, needEnd.length);
console.error(`[${id}] ending ${i}/${needEnd.length}`);
endMe.end('end');
});
});
Expand Down Expand Up @@ -107,7 +107,7 @@ if (process.argv[2] === 'child') {
connected += 1;

socket.once('close', function() {
console.log('[m] socket closed, total %d', ++closed);
console.log(`[m] socket closed, total ${++closed}`);
});

if (connected === count) {
Expand Down