mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
e0faf8c3e9
PR-URL: https://github.com/nodejs/node/pull/40344 Fixes: https://github.com/nodejs/node/issues/40336 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com>
28 lines
617 B
JavaScript
28 lines
617 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const net = require('net');
|
|
|
|
{
|
|
const invalidKeys = [
|
|
'objectMode',
|
|
'readableObjectMode',
|
|
'writableObjectMode',
|
|
];
|
|
invalidKeys.forEach((invalidKey) => {
|
|
const option = {
|
|
[invalidKey]: true
|
|
};
|
|
const message = `The property 'options.${invalidKey}' is not supported. Received true`;
|
|
|
|
assert.throws(() => {
|
|
const socket = new net.Socket(option);
|
|
socket.connect({ port: 8080 });
|
|
}, {
|
|
code: 'ERR_INVALID_ARG_VALUE',
|
|
name: 'TypeError',
|
|
message: new RegExp(message)
|
|
});
|
|
});
|
|
}
|