mirror of
https://github.com/nodejs/node.git
synced 2025-05-19 20:06:58 +00:00

... in addition to the event names they currently use. Currently, various internal streams have different events that indicate that the underlying resource has successfully been established. This commit adds ready event for fs and net sockets to standardize on emitting ready for all of these streams. PR-URL: https://github.com/nodejs/node/pull/19408 Fixes: https://github.com/nodejs/node/issues/19304 Reviewed-By: Anna Henningsen <anna@addaleax.net>
21 lines
469 B
JavaScript
21 lines
469 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
// This test ensures that socket.connect can be called without callback
|
|
// which is optional.
|
|
|
|
const net = require('net');
|
|
|
|
const server = net.createServer(common.mustCall(function(conn) {
|
|
conn.end();
|
|
server.close();
|
|
})).listen(0, common.mustCall(function() {
|
|
const client = new net.Socket();
|
|
|
|
client.on('ready', common.mustCall(function() {
|
|
client.end();
|
|
}));
|
|
|
|
client.connect(server.address());
|
|
}));
|