Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fishrock123 pr backport test 3 #31

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ rules:
computed-property-spacing: 2
eol-last: 2
func-call-spacing: 2
func-name-matching: 2
indent: [2, 2, {SwitchCase: 1, MemberExpression: 1}]
key-spacing: [2, {mode: minimum}]
keyword-spacing: 2
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Node.js

// HI THIS SHOULD NOT CAUSE CONFLICTS

[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/nodejs/node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/29/badge)](https://bestpractices.coreinfrastructure.org/projects/29)

Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js
Expand Down Expand Up @@ -186,6 +188,8 @@ more information about the governance of the Node.js project, see
**Shigeki Ohtsu** <ohtsu@iij.ad.jp>
* [TheAlphaNerd](https://github.com/TheAlphaNerd) -
**Myles Borins** <myles.borins@gmail.com>
* [thefourtheye](https://github.com/thefourtheye) -
**Sakthipriyan Vairamani** <thechargingvolcano@gmail.com>
* [trevnorris](https://github.com/trevnorris) -
**Trevor Norris** <trev.norris@gmail.com>
* [Trott](https://github.com/Trott) -
Expand Down Expand Up @@ -319,8 +323,6 @@ more information about the governance of the Node.js project, see
**Michaël Zasso** <targos@protonmail.com>
* [tellnes](https://github.com/tellnes) -
**Christian Tellnes** <christian@tellnes.no>
* [thefourtheye](https://github.com/thefourtheye) -
**Sakthipriyan Vairamani** <thechargingvolcano@gmail.com>
* [thekemkid](https://github.com/thekemkid) -
**Glen Keane** <glenkeane.94@gmail.com>
* [thlorenz](https://github.com/thlorenz) -
Expand Down
23 changes: 14 additions & 9 deletions WORKING_GROUPS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ back in to the CTC.
* [Website](#website)
* [Streams](#streams)
* [Build](#build)
* [Tracing](#tracing)
* [Diagnostics](#diagnostics)
* [i18n](#i18n)
* [Evangelism](#evangelism)
* [Roadmap](#roadmap)
Expand Down Expand Up @@ -81,17 +81,22 @@ Its responsibilities are:
* Creates and manages build-containers.


### [Tracing](https://github.com/nodejs/tracing-wg)
### [Diagnostics](https://github.com/nodejs/diagnostics)

The tracing working group's purpose is to increase the
transparency of software written in Node.js.
The diagnostics working group's purpose is to surface a set of comprehensive,
documented, and extensible diagnostic interfaces for use by
Node.js tools and JavaScript VMs.

Its responsibilities are:
* Collaboration with V8 to integrate with `trace_event`.
* Maintenance and iteration on AsyncWrap.
* Maintenance and improvements to system tracing support (DTrace, LTTng, etc.)
* Documentation of tracing and debugging techniques.
* Fostering a tracing and debugging ecosystem.

* Collaborate with V8 to integrate `v8_inspector` into Node.js.
* Collaborate with V8 to integrate `trace_event` into Node.js.
* Collaborate with Core to refine `async_wrap` and `async_hooks`.
* Maintain and improve OS trace system integration (e.g. ETW, LTTNG, dtrace).
* Document diagnostic capabilities and APIs in Node.js and its components.
* Explore opportunities and gaps, discuss feature requests, and address
conflicts in Node.js diagnostics.
* Foster an ecosystem of diagnostics tools for Node.js.

### i18n

Expand Down
2 changes: 1 addition & 1 deletion lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ function checkExecSyncError(ret) {
if (!err) {
var msg = 'Command failed: ';
msg += ret.cmd || ret.args.join(' ');
if (ret.stderr)
if (ret.stderr && ret.stderr.length > 0)
msg += '\n' + ret.stderr.toString();
err = new Error(msg);
}
Expand Down
6 changes: 6 additions & 0 deletions lib/internal/bootstrap_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@
}

function setupGlobalVariables() {
Object.defineProperty(global, Symbol.toStringTag, {
value: 'global',
writable: false,
enumerable: false,
configurable: true
});
global.process = process;
const util = NativeModule.require('util');

Expand Down
20 changes: 10 additions & 10 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ const parentModule = module;
const replMap = new WeakMap();

const GLOBAL_OBJECT_PROPERTIES = ['NaN', 'Infinity', 'undefined',
'eval', 'parseInt', 'parseFloat', 'isNaN', 'isFinite', 'decodeURI',
'decodeURIComponent', 'encodeURI', 'encodeURIComponent',
'Object', 'Function', 'Array', 'String', 'Boolean', 'Number',
'Date', 'RegExp', 'Error', 'EvalError', 'RangeError',
'ReferenceError', 'SyntaxError', 'TypeError', 'URIError',
'Math', 'JSON'];
'eval', 'parseInt', 'parseFloat', 'isNaN', 'isFinite', 'decodeURI',
'decodeURIComponent', 'encodeURI', 'encodeURIComponent',
'Object', 'Function', 'Array', 'String', 'Boolean', 'Number',
'Date', 'RegExp', 'Error', 'EvalError', 'RangeError',
'ReferenceError', 'SyntaxError', 'TypeError', 'URIError',
'Math', 'JSON'];
const GLOBAL_OBJECT_PROPERTY_MAP = {};
GLOBAL_OBJECT_PROPERTIES.forEach((p) => GLOBAL_OBJECT_PROPERTY_MAP[p] = p);

Expand Down Expand Up @@ -783,7 +783,7 @@ ArrayStream.prototype.writable = true;
ArrayStream.prototype.resume = function() {};
ArrayStream.prototype.write = function() {};

const requireRE = /\brequire\s*\(['"](([\w\.\/-]+\/)?([\w\.\/-]*))/;
const requireRE = /\brequire\s*\(['"](([\w./-]+\/)?([\w./-]*))/;
const simpleExpressionRE =
/(([a-zA-Z_$](?:\w|\$)*)\.)*([a-zA-Z_$](?:\w|\$)*)\.?$/;

Expand Down Expand Up @@ -1036,7 +1036,7 @@ function complete(line, callback) {
var newCompletionGroups = [];
for (i = 0; i < completionGroups.length; i++) {
group = completionGroups[i].filter(function(elem) {
return elem.indexOf(filter) == 0;
return elem.indexOf(filter) === 0;
});
if (group.length) {
newCompletionGroups.push(group);
Expand Down Expand Up @@ -1341,8 +1341,8 @@ function regexpEscape(s) {
// TODO(princejwesley): Remove it prior to v8.0.0 release
// Reference: https://github.com/nodejs/node/pull/7829
REPLServer.prototype.convertToContext = util.deprecate(function(cmd) {
const scopeVar = /^\s*var\s*([_\w\$]+)(.*)$/m;
const scopeFunc = /^\s*function\s*([_\w\$]+)/;
const scopeVar = /^\s*var\s*([\w$]+)(.*)$/m;
const scopeFunc = /^\s*function\s*([\w$]+)/;
var matches;

// Replaces: var foo = "bar"; with: self.context.foo = bar;
Expand Down
3 changes: 1 addition & 2 deletions lib/zlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,7 @@ function Zlib(opts, mode) {
opts.finishFlush : constants.Z_FINISH;

if (opts.chunkSize) {
if (opts.chunkSize < constants.Z_MIN_CHUNK ||
opts.chunkSize > constants.Z_MAX_CHUNK) {
if (opts.chunkSize < constants.Z_MIN_CHUNK) {
throw new Error('Invalid chunk size: ' + opts.chunkSize);
}
}
Expand Down
2 changes: 2 additions & 0 deletions test/parallel/test-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ const fooBar = module.fooBar;
assert.strictEqual('foo', fooBar.foo, 'x -> global.x in sub level not working');

assert.strictEqual('bar', fooBar.bar, 'global.x -> x in sub level not working');

assert.strictEqual(Object.prototype.toString.call(global), '[object global]');
37 changes: 18 additions & 19 deletions test/parallel/test-stream2-readable-empty-buffer-no-eof.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const common = require('../common');
require('../common');
const assert = require('assert');

const Readable = require('stream').Readable;
Expand All @@ -16,36 +16,35 @@ function test1() {
//
// note that this is very unusual. it only works for crypto streams
// because the other side of the stream will call read(0) to cycle
// data through openssl. that's why we set the timeouts to call
// data through openssl. that's why setImmediate() is used to call
// r.read(0) again later, otherwise there is no more work being done
// and the process just exits.

const buf = Buffer.alloc(5, 'x');
let reads = 5;
const timeout = common.platformTimeout(50);
r._read = function(n) {
switch (reads--) {
case 0:
return r.push(null); // EOF
case 1:
return r.push(buf);
case 2:
setTimeout(r.read.bind(r, 0), timeout);
return r.push(Buffer.alloc(0)); // Not-EOF!
case 3:
setTimeout(r.read.bind(r, 0), timeout);
return process.nextTick(function() {
return r.push(Buffer.alloc(0));
case 5:
return setImmediate(function() {
return r.push(buf);
});
case 4:
setTimeout(r.read.bind(r, 0), timeout);
return setTimeout(function() {
setImmediate(function() {
return r.push(Buffer.alloc(0));
});
case 5:
return setTimeout(function() {
return r.push(buf);
return setImmediate(r.read.bind(r, 0));
case 3:
setImmediate(r.read.bind(r, 0));
return process.nextTick(function() {
return r.push(Buffer.alloc(0));
});
case 2:
setImmediate(r.read.bind(r, 0));
return r.push(Buffer.alloc(0)); // Not-EOF!
case 1:
return r.push(buf);
case 0:
return r.push(null); // EOF
default:
throw new Error('unreachable');
}
Expand Down
105 changes: 105 additions & 0 deletions test/parallel/test-zlib-deflate-constructors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
'use strict';

require('../common');

const zlib = require('zlib');
const assert = require('assert');

// Work with and without `new` keyword
assert.ok(zlib.Deflate() instanceof zlib.Deflate);
assert.ok(new zlib.Deflate() instanceof zlib.Deflate);

assert.ok(zlib.DeflateRaw() instanceof zlib.DeflateRaw);
assert.ok(new zlib.DeflateRaw() instanceof zlib.DeflateRaw);

// Throws if `opts.chunkSize` is invalid
assert.throws(
() => { new zlib.Deflate({chunkSize: -Infinity}); },
/^Error: Invalid chunk size: -Infinity$/
);

// Confirm that maximum chunk size cannot be exceeded because it is `Infinity`.
assert.strictEqual(zlib.constants.Z_MAX_CHUNK, Infinity);

// Throws if `opts.windowBits` is invalid
assert.throws(
() => { new zlib.Deflate({windowBits: -Infinity}); },
/^Error: Invalid windowBits: -Infinity$/
);

assert.throws(
() => { new zlib.Deflate({windowBits: Infinity}); },
/^Error: Invalid windowBits: Infinity$/
);

// Throws if `opts.level` is invalid
assert.throws(
() => { new zlib.Deflate({level: -Infinity}); },
/^Error: Invalid compression level: -Infinity$/
);

assert.throws(
() => { new zlib.Deflate({level: Infinity}); },
/^Error: Invalid compression level: Infinity$/
);

// Throws a RangeError if `level` invalid in `Deflate.prototype.params()`
assert.throws(
() => { new zlib.Deflate().params(-Infinity); },
/^RangeError: Invalid compression level: -Infinity$/
);

assert.throws(
() => { new zlib.Deflate().params(Infinity); },
/^RangeError: Invalid compression level: Infinity$/
);

// Throws if `opts.memLevel` is invalid
assert.throws(
() => { new zlib.Deflate({memLevel: -Infinity}); },
/^Error: Invalid memLevel: -Infinity$/
);

assert.throws(
() => { new zlib.Deflate({memLevel: Infinity}); },
/^Error: Invalid memLevel: Infinity$/
);

// Does not throw if opts.strategy is valid
assert.doesNotThrow(
() => { new zlib.Deflate({strategy: zlib.constants.Z_FILTERED}); }
);

assert.doesNotThrow(
() => { new zlib.Deflate({strategy: zlib.constants.Z_HUFFMAN_ONLY}); }
);

assert.doesNotThrow(
() => { new zlib.Deflate({strategy: zlib.constants.Z_RLE}); }
);

assert.doesNotThrow(
() => { new zlib.Deflate({strategy: zlib.constants.Z_FIXED}); }
);

assert.doesNotThrow(
() => { new zlib.Deflate({ strategy: zlib.constants.Z_DEFAULT_STRATEGY}); }
);

// Throws if opts.strategy is invalid
assert.throws(
() => { new zlib.Deflate({strategy: 'this is a bogus strategy'}); },
/^Error: Invalid strategy: this is a bogus strategy$/
);

// Throws TypeError if `strategy` is invalid in `Deflate.prototype.params()`
assert.throws(
() => { new zlib.Deflate().params(0, 'I am an invalid strategy'); },
/^TypeError: Invalid strategy: I am an invalid strategy$/
);

// Throws if opts.dictionary is not a Buffer
assert.throws(
() => { new zlib.Deflate({dictionary: 'not a buffer'}); },
/^Error: Invalid dictionary: it should be a Buffer instance$/
);
2 changes: 1 addition & 1 deletion test/sequential/test-child-process-execsync.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ assert.strictEqual(ret, msg + '\n',
const msg = `Command failed: ${process.execPath} ${args.join(' ')}`;

assert(err instanceof Error);
assert.strictEqual(err.message.trim(), msg);
assert.strictEqual(err.message, msg);
assert.strictEqual(err.status, 1);
return true;
});
Expand Down