node/test/parallel/test-net-better-error-messages-path.js
Mithun Sasidharan eae0c05697
test: replace assert.throws w/ common.expectsError
PR-URL: https://github.com/nodejs/node/pull/17498
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
2017-12-08 16:02:07 -05:00

22 lines
408 B
JavaScript

'use strict';
const common = require('../common');
const net = require('net');
{
const fp = '/tmp/fadagagsdfgsdf';
const c = net.connect(fp);
c.on('connect', common.mustNotCall());
c.on('error', common.expectsError({
code: 'ENOENT',
message: `connect ENOENT ${fp}`
}));
}
{
common.expectsError(
() => net.createConnection({ path: {} }),
{ code: 'ERR_INVALID_ARG_TYPE' }
);
}