mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
Export a new common.noop no-operation function for general use. Allow using common.mustCall() without a fn argument to simplify test cases. Replace various non-op functions throughout tests with common.noop PR-URL: https://github.com/nodejs/node/pull/12027 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
16 lines
329 B
JavaScript
16 lines
329 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const net = require('net');
|
|
|
|
const server = net.createServer();
|
|
server.listen(0);
|
|
const port = server.address().port;
|
|
const conn = net.createConnection(port);
|
|
|
|
conn.on('error', common.mustCall(() => {
|
|
conn.destroy();
|
|
}));
|
|
|
|
conn.on('close', common.mustCall());
|
|
server.close();
|