node: Updated definitions and tests for ChildProcess#send method

This commit is contained in:
chugaev
2017-07-12 02:11:00 +03:00
parent dc3ec8e3c2
commit a3fb24fb08
2 changed files with 154 additions and 154 deletions
+93 -93
View File
@@ -13,10 +13,10 @@
// TypeScript Version: 2.2
/************************************************
* *
* Node.js v8.x API *
* *
************************************************/
* *
* Node.js v8.x API *
* *
************************************************/
// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
interface Console {
@@ -61,10 +61,10 @@ interface SymbolConstructor {
declare var Symbol: SymbolConstructor;
/************************************************
* *
* GLOBAL *
* *
************************************************/
* *
* GLOBAL *
* *
************************************************/
declare var process: NodeJS.Process;
declare var global: NodeJS.Global;
declare var console: Console;
@@ -262,10 +262,10 @@ declare var Buffer: {
};
/************************************************
* *
* GLOBAL INTERFACES *
* *
************************************************/
* *
* GLOBAL INTERFACES *
* *
************************************************/
declare namespace NodeJS {
export interface InspectOptions {
showHidden?: boolean;
@@ -373,14 +373,14 @@ declare namespace NodeJS {
}
type Platform = 'aix'
| 'android'
| 'darwin'
| 'freebsd'
| 'linux'
| 'openbsd'
| 'sunos'
| 'win32'
| 'cygwin';
| 'android'
| 'darwin'
| 'freebsd'
| 'linux'
| 'openbsd'
| 'sunos'
| 'win32'
| 'cygwin';
type Signals =
"SIGABRT" | "SIGALRM" | "SIGBUS" | "SIGCHLD" | "SIGCONT" | "SIGFPE" | "SIGHUP" | "SIGILL" | "SIGINT" | "SIGIO" |
@@ -405,7 +405,7 @@ declare namespace NodeJS {
}
export interface ProcessEnv {
[key: string]: string | undefined
[key: string]: string | undefined
}
export interface Process extends EventEmitter {
@@ -710,10 +710,10 @@ interface NodeBuffer extends Uint8Array {
}
/************************************************
* *
* MODULES *
* *
************************************************/
* *
* MODULES *
* *
************************************************/
declare module "buffer" {
export var INSPECT_MAX_BYTES: number;
var BuffType: typeof Buffer;
@@ -801,7 +801,7 @@ declare module "http" {
}
export interface ServerResponseHeaders {
[key: string]: number | string | string[];
[key: string]: number | string | string[];
}
export interface ServerResponse extends stream.Writable {
@@ -1218,14 +1218,14 @@ declare module "zlib" {
import * as stream from "stream";
export interface ZlibOptions {
flush?: number; // default: zlib.constants.Z_NO_FLUSH
finishFlush?: number; // default: zlib.constants.Z_FINISH
chunkSize?: number; // default: 16*1024
windowBits?: number;
level?: number; // compression only
memLevel?: number; // compression only
strategy?: number; // compression only
dictionary?: any; // deflate/inflate only, empty dictionary by default
flush?: number; // default: zlib.constants.Z_NO_FLUSH
finishFlush?: number; // default: zlib.constants.Z_FINISH
chunkSize?: number; // default: 16*1024
windowBits?: number;
level?: number; // compression only
memLevel?: number; // compression only
strategy?: number; // compression only
dictionary?: any; // deflate/inflate only, empty dictionary by default
}
export interface Gzip extends stream.Transform { }
@@ -3220,7 +3220,7 @@ declare module "tls" {
}
export interface DetailedPeerCertificate extends PeerCertificate {
issuerCertificate: DetailedPeerCertificate;
issuerCertificate: DetailedPeerCertificate;
}
export interface CipherNameAndProtocol {
@@ -3239,64 +3239,64 @@ declare module "tls" {
* Construct a new tls.TLSSocket object from an existing TCP socket.
*/
constructor(socket:net.Socket, options?: {
/**
* An optional TLS context object from tls.createSecureContext()
*/
secureContext?: SecureContext,
/**
* If true the TLS socket will be instantiated in server-mode.
* Defaults to false.
*/
isServer?: boolean,
/**
* An optional net.Server instance.
*/
server?: net.Server,
/**
* If true the server will request a certificate from clients that
* connect and attempt to verify that certificate. Defaults to
* false.
*/
requestCert?: boolean,
/**
* If true the server will reject any connection which is not
* authorized with the list of supplied CAs. This option only has an
* effect if requestCert is true. Defaults to false.
*/
rejectUnauthorized?: boolean,
/**
* An array of strings or a Buffer naming possible NPN protocols.
* (Protocols should be ordered by their priority.)
*/
NPNProtocols?: string[] | Buffer,
/**
* An array of strings or a Buffer naming possible ALPN protocols.
* (Protocols should be ordered by their priority.) When the server
* receives both NPN and ALPN extensions from the client, ALPN takes
* precedence over NPN and the server does not send an NPN extension
* to the client.
*/
ALPNProtocols?: string[] | Buffer,
/**
* SNICallback(servername, cb) <Function> A function that will be
* called if the client supports SNI TLS extension. Two arguments
* will be passed when called: servername and cb. SNICallback should
* invoke cb(null, ctx), where ctx is a SecureContext instance.
* (tls.createSecureContext(...) can be used to get a proper
* SecureContext.) If SNICallback wasn't provided the default callback
* with high-level API will be used (see below).
*/
SNICallback?: Function,
/**
* An optional Buffer instance containing a TLS session.
*/
session?: Buffer,
/**
* If true, specifies that the OCSP status request extension will be
* added to the client hello and an 'OCSPResponse' event will be
* emitted on the socket before establishing a secure communication
*/
requestOCSP?: boolean
/**
* An optional TLS context object from tls.createSecureContext()
*/
secureContext?: SecureContext,
/**
* If true the TLS socket will be instantiated in server-mode.
* Defaults to false.
*/
isServer?: boolean,
/**
* An optional net.Server instance.
*/
server?: net.Server,
/**
* If true the server will request a certificate from clients that
* connect and attempt to verify that certificate. Defaults to
* false.
*/
requestCert?: boolean,
/**
* If true the server will reject any connection which is not
* authorized with the list of supplied CAs. This option only has an
* effect if requestCert is true. Defaults to false.
*/
rejectUnauthorized?: boolean,
/**
* An array of strings or a Buffer naming possible NPN protocols.
* (Protocols should be ordered by their priority.)
*/
NPNProtocols?: string[] | Buffer,
/**
* An array of strings or a Buffer naming possible ALPN protocols.
* (Protocols should be ordered by their priority.) When the server
* receives both NPN and ALPN extensions from the client, ALPN takes
* precedence over NPN and the server does not send an NPN extension
* to the client.
*/
ALPNProtocols?: string[] | Buffer,
/**
* SNICallback(servername, cb) <Function> A function that will be
* called if the client supports SNI TLS extension. Two arguments
* will be passed when called: servername and cb. SNICallback should
* invoke cb(null, ctx), where ctx is a SecureContext instance.
* (tls.createSecureContext(...) can be used to get a proper
* SecureContext.) If SNICallback wasn't provided the default callback
* with high-level API will be used (see below).
*/
SNICallback?: Function,
/**
* An optional Buffer instance containing a TLS session.
*/
session?: Buffer,
/**
* If true, specifies that the OCSP status request extension will be
* added to the client hello and an 'OCSPResponse' event will be
* emitted on the socket before establishing a secure communication
*/
requestOCSP?: boolean
});
/**
* Returns the bound address, the address family name and port of the underlying socket as reported by
+61 -61
View File
@@ -221,19 +221,19 @@ namespace fs_tests {
{
fs.watch('/tmp/foo-', (event, filename) => {
console.log(event, filename);
console.log(event, filename);
});
fs.watch('/tmp/foo-', 'utf8', (event, filename) => {
console.log(event, filename);
console.log(event, filename);
});
fs.watch('/tmp/foo-', {
recursive: true,
persistent: true,
encoding: 'utf8'
recursive: true,
persistent: true,
encoding: 'utf8'
}, (event, filename) => {
console.log(event, filename);
console.log(event, filename);
});
}
@@ -355,9 +355,9 @@ function bufferTests() {
let val: [number, number];
/* comment out for --target es5
for (let entry of buffer.entries()) {
val = entry;
}
for (let entry of buffer.entries()) {
val = entry;
}
*/
}
@@ -380,9 +380,9 @@ function bufferTests() {
let val: number;
/* comment out for --target es5
for (let key of buffer.keys()) {
val = key;
}
for (let key of buffer.keys()) {
val = key;
}
*/
}
@@ -391,9 +391,9 @@ function bufferTests() {
let val: number;
/* comment out for --target es5
for (let value of buffer.values()) {
val = value;
}
for (let value of buffer.values()) {
val = value;
}
*/
}
@@ -407,8 +407,8 @@ function bufferTests() {
// Buffer has Uint8Array's buffer field (an ArrayBuffer).
{
let buffer = new Buffer('123');
let octets = new Uint8Array(buffer.buffer);
let buffer = new Buffer('123');
let octets = new Uint8Array(buffer.buffer);
}
}
@@ -542,20 +542,20 @@ namespace util_tests {
util.inspect(["This is nice"], false, 5);
util.inspect(["This is nice"], false, null);
util.inspect(["This is nice"], {
colors: true,
depth: 5,
customInspect: false,
showProxy: true,
maxArrayLength: 10,
breakLength: 20
colors: true,
depth: 5,
customInspect: false,
showProxy: true,
maxArrayLength: 10,
breakLength: 20
});
util.inspect(["This is nice"], {
colors: true,
depth: null,
customInspect: false,
showProxy: true,
maxArrayLength: null,
breakLength: Infinity
colors: true,
depth: null,
customInspect: false,
showProxy: true,
maxArrayLength: null,
breakLength: Infinity
})
assert(typeof util.inspect.custom === 'symbol')
// util.promisify
@@ -732,12 +732,12 @@ namespace crypto_tests {
}
{
let buffer1: Buffer = new Buffer([1, 2, 3, 4, 5]);
let buffer2: Buffer = new Buffer([1, 2, 3, 4, 5]);
let buffer3: Buffer = new Buffer([5, 4, 3, 2, 1]);
let buffer1: Buffer = new Buffer([1, 2, 3, 4, 5]);
let buffer2: Buffer = new Buffer([1, 2, 3, 4, 5]);
let buffer3: Buffer = new Buffer([5, 4, 3, 2, 1]);
assert(crypto.timingSafeEqual(buffer1, buffer2))
assert(!crypto.timingSafeEqual(buffer1, buffer3))
assert(crypto.timingSafeEqual(buffer1, buffer2))
assert(!crypto.timingSafeEqual(buffer1, buffer3))
}
{
@@ -972,20 +972,20 @@ namespace tls_tests {
namespace http_tests {
{
// Status codes
var codeMessage = http.STATUS_CODES['400'];
var codeMessage = http.STATUS_CODES[400];
// Status codes
var codeMessage = http.STATUS_CODES['400'];
var codeMessage = http.STATUS_CODES[400];
}
{
var agent: http.Agent = new http.Agent({
keepAlive: true,
keepAliveMsecs: 10000,
maxSockets: Infinity,
maxFreeSockets: 256
});
var agent: http.Agent = new http.Agent({
keepAlive: true,
keepAliveMsecs: 10000,
maxSockets: Infinity,
maxFreeSockets: 256
});
var agent: http.Agent = http.globalAgent;
var agent: http.Agent = http.globalAgent;
http.request({ agent: false });
http.request({ agent: agent });
@@ -1005,9 +1005,9 @@ namespace http_tests {
request.abort();
}
const options: http.RequestOptions = {
const options: http.RequestOptions = {
timeout: 30000
};
};
}
//////////////////////////////////////////////////////
@@ -1059,18 +1059,18 @@ namespace tty_tests {
namespace dgram_tests {
{
var ds: dgram.Socket = dgram.createSocket("udp4", (msg: Buffer, rinfo: dgram.RemoteInfo): void => {
});
ds.bind();
ds.bind(41234);
ds.bind(4123, 'localhost');
ds.bind(4123, 'localhost', () => {});
ds.bind(4123, () => {});
ds.bind(() => {});
var ai: dgram.AddressInfo = ds.address();
ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => {
});
ds.send(new Buffer("hello"), 5000, "127.0.0.1");
var ds: dgram.Socket = dgram.createSocket("udp4", (msg: Buffer, rinfo: dgram.RemoteInfo): void => {
});
ds.bind();
ds.bind(41234);
ds.bind(4123, 'localhost');
ds.bind(4123, 'localhost', () => {});
ds.bind(4123, () => {});
ds.bind(() => {});
var ai: dgram.AddressInfo = ds.address();
ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => {
});
ds.send(new Buffer("hello"), 5000, "127.0.0.1");
}
{
@@ -2075,9 +2075,9 @@ namespace net_tests {
let server = net.createServer();
// Check methods which return server instances by chaining calls
server = server.listen(0)
.close()
.ref()
.unref();
.close()
.ref()
.unref();
// close has an optional callback function. No callback parameters are
// specified, so any callback function is permissible.