node/test/parallel/test-tls-wrap-econnreset-pipe.js
Rich Trott bf6ce47259 test: move tmpdir to submodule of common
Move tmpdir functionality to its own module (common/tmpdir).

PR-URL: https://github.com/nodejs/node/pull/17856
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2018-01-31 22:11:07 -08:00

27 lines
717 B
JavaScript

'use strict';
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const assert = require('assert');
const tls = require('tls');
const net = require('net');
const tmpdir = require('../common/tmpdir');
tmpdir.refresh();
const server = net.createServer((c) => {
c.end();
}).listen(common.PIPE, common.mustCall(() => {
tls.connect({ path: common.PIPE })
.once('error', common.mustCall((e) => {
assert.strictEqual(e.code, 'ECONNRESET');
assert.strictEqual(e.path, common.PIPE);
assert.strictEqual(e.port, undefined);
assert.strictEqual(e.host, undefined);
assert.strictEqual(e.localAddress, undefined);
server.close();
}));
}));