- 7.7.1
+ 7.7.2
+ 7.7.1 7.7.0 7.6.0 7.5.0
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index bf3dbd0ad0e163..290cad8faaeb7a 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -46,15 +46,6 @@ $ git remote add upstream git://github.com/nodejs/node.git
For developing new features and bug fixes, the `master` branch should be pulled
and built upon.
-#### Respect the stability index
-
-The rules for the master branch are less strict; consult the
-[stability index](./doc/api/documentation.md#stability-index) for details.
-
-In a nutshell, modules are at varying levels of API stability. Bug fixes are
-always welcome but API or behavioral changes to modules at stability level 3
-(Locked) are off-limits.
-
#### Dependencies
Node.js has several bundled dependencies in the *deps/* and the *tools/*
diff --git a/README.md b/README.md
index 7fe05e05e27ad0..5db1b427ce499e 100644
--- a/README.md
+++ b/README.md
@@ -337,6 +337,8 @@ more information about the governance of the Node.js project, see
**Mike Tunnicliffe** <m.j.tunnicliffe@gmail.com>
* [vkurchatkin](https://github.com/vkurchatkin) -
**Vladimir Kurchatkin** <vladimir.kurchatkin@gmail.com>
+* [watilde](https://github.com/watilde) -
+**Daijiro Wachi** <daijiro.wachi@gmail.com> (he/him)
* [whitlockjc](https://github.com/whitlockjc) -
**Jeremy Whitlock** <jwhitlock@apache.org>
* [yorkie](https://github.com/yorkie) -
@@ -393,6 +395,11 @@ Previous releases may also have been signed with one of the following GPG keys:
* **Timothy J Fontaine** <tjfontaine@gmail.com>
`7937DFD2AB06298B2293C3187D33FF9D0246406D`
+### Working Groups
+
+Information on the current Node.js Working Groups can be found in the
+[CTC repository](https://github.com/nodejs/CTC/blob/master/WORKING_GROUPS.md).
+
[npm]: https://www.npmjs.com
[Website]: https://nodejs.org/en/
[Contributing to the project]: CONTRIBUTING.md
diff --git a/ROADMAP.md b/ROADMAP.md
deleted file mode 100644
index da8e47941916cc..00000000000000
--- a/ROADMAP.md
+++ /dev/null
@@ -1,84 +0,0 @@
-# Node.js Roadmap
-
-***This is a living document, it describes the policy and priorities as they exist today but can evolve over time.***
-
-## Stability Policy
-
-The most important consideration in every code change is the impact it will have, positive or negative, on the ecosystem (modules and applications).
-
-Node.js does not remove stdlib JS API.
-
-Shipping with current and well supported dependencies is the best way to ensure long term stability of the platform.
-
-Node.js will continue to adopt new V8 releases.
-* When V8 ships a breaking change to their C++ API that can be handled by [`nan`](https://github.com/nodejs/nan)
-the *minor* version of Node.js will be increased.
-* When V8 ships a breaking change to their C++ API that can NOT be handled by [`nan`](https://github.com/nodejs/nan)
-the *major* version of Node.js will be increased.
-* When new features in the JavaScript language are introduced by V8 the
-*minor* version number will be increased. TC39 has stated clearly that no
-backwards incompatible changes will be made to the language so it is
-appropriate to increase the minor rather than major.
-
-No new API will be added in *patch* releases.
-
-Any API addition will cause an increase in the *minor* version.
-
-## Channels
-
-Channels are points of collaboration with the broader community and are not strictly scoped to a repository or branch.
-
-* Release - Stable production ready builds. Unique version numbers following semver.
-* Canary - Nightly builds w/ V8 version in Chrome Canary + changes landing to Node.js. No version designation.
-* NG - "Next Generation." No version designation.
-
-## NG (Next Generation)
-
-In order for Node.js to stay competitive we need to work on the next generation of the platform which will more accurately integrate and reflect the advancements in the language and the ecosystem.
-
-While this constitutes a great leap forward for the platform we will be making this leap without breaking backwards compatibility with the existing ecosystem of modules.
-
-## Immediate Priorities
-
-### Debugging and Tracing
-
-Debugging is one of the first things from everyone's mouth, both developer and enterprise, when describing trouble they've had with Node.js.
-
-The goal of Node.js' effort is to build a healthy debugging and tracing ecosystem and not to try and build any "silver bullet" features for core (like the domains debacle).
-
-The [Tracing WG](https://github.com/nodejs/tracing-wg) is driving this effort:
-
-* AsyncWrap improvements - basically just iterations based on feedback from people using it.
-* async-listener - userland module that will dogfood AsyncWrap as well as provide many often requested debugging features.
-* Tracing
- * Add tracing support for more platforms (LTTng, etc).
- * [Unify the Tracing endpoint](https://github.com/nodejs/node/issues/729).
- * New Chrome Debugger - Google is working on a version of Chrome's debugger that is without Chrome and can be used with Node.js.
-
-### Ecosystem Automation
-
-In order to maintain a good release cadence without harming compatibility we must do a better job of understanding exactly what impact a particular change or release will have on the ecosystem. This requires new automation.
-
-The initial goals for this automation are relatively simple but will create a baseline toolchain we can continue to improve upon.
-
-* Produce a list of modules that no longer build between two release versions.
-* Produce a list of modules that use a particular core API.
-* Produce detailed code coverage data for the tests in core.
-
-### Improve Installation and Upgrades
-
-* Host and maintain registry endpoints (Homebrew, apt, etc).
-* Document installation and upgrade procedures with an emphasis on using nvm or nave for development and our registry endpoints for traditional package managers and production.
-
-### Streams
-
-* Fix all existing compatibility issues.
-* Simplify stream creation to avoid user error.
-* Explore and identify compatibility issues with [WHATWG Streams](https://github.com/whatwg/streams).
-* Improve stream performance.
-
-### Internationalization / Localization
-
-* Build documentation tooling with localization support built in.
-* Reduce size of ICU and ship with it by default.
-* Continue growth of our i18n community.
diff --git a/WORKING_GROUPS.md b/WORKING_GROUPS.md
deleted file mode 100644
index 6ba06c9cafa697..00000000000000
--- a/WORKING_GROUPS.md
+++ /dev/null
@@ -1,281 +0,0 @@
-# Node.js Core Working Groups
-
-Node.js Core Working Groups are autonomous projects created by the
-[Core Technical Committee (CTC)](https://github.com/nodejs/node/blob/master/GOVERNANCE.md#core-technical-committee).
-
-Working Groups can be formed at any time but must be ratified by the CTC.
-Once formed the work defined in the Working Group charter is the
-responsibility of the WG rather than the CTC.
-
-It is important that Working Groups are not formed pre-maturely. Working
-Groups are not formed to *begin* a set of tasks but instead are formed
-once that work is already underway and the contributors
-think it would benefit from being done as an autonomous project.
-
-If the work defined in a Working Group's charter is complete, the charter
-should be revoked.
-
-A Working Group's charter can be revoked either by consensus of the Working
-Group's members or by a CTC vote. Once revoked, any future work that arises
-becomes the responsibility of the CTC.
-
-## Joining a WG
-
-To find out how to join a working group, consult the GOVERNANCE.md in
-the working group's repository, or in the working group's repository.
-
-## Starting A Core Working Group
-
-The process to start a Core Working Group is identical to [creating a
-Top Level Working Group](https://github.com/nodejs/TSC/blob/master/WORKING_GROUPS.md#starting-a-wg).
-
-## Current Working Groups
-
-* [Website](#website)
-* [Streams](#streams)
-* [Build](#build)
-* [Diagnostics](#diagnostics)
-* [i18n](#i18n)
-* [Evangelism](#evangelism)
-* [Docker](#docker)
-* [Addon API](#addon-api)
-* [Benchmarking](#benchmarking)
-* [Post-mortem](#post-mortem)
-* [Intl](#intl)
-* [Documentation](#documentation)
-* [Testing](#testing)
-
-
-### [Website](https://github.com/nodejs/nodejs.org)
-
-The website Working Group's purpose is to build and maintain a public
-website for the Node.js project.
-
-Responsibilities include:
-* Developing and maintaining a build and automation system for nodejs.org.
-* Ensuring the site is regularly updated with changes made to Node.js, like
- releases and features.
-* Fostering and enabling a community of translators.
-
-### [Streams](https://github.com/nodejs/readable-stream)
-
-The Streams Working Group is dedicated to the support and improvement of the
-Streams API as used in Node.js and the npm ecosystem. We seek to create a
-composable API that solves the problem of representing multiple occurrences
-of an event over time in a humane, low-overhead fashion. Improvements to the
-API will be driven by the needs of the ecosystem; interoperability and
-backwards compatibility with other solutions and prior versions are paramount
-in importance.
-
-Responsibilities include:
-* Addressing stream issues on the Node.js issue tracker.
-* Authoring and editing stream documentation within the Node.js project.
-* Reviewing changes to stream subclasses within the Node.js project.
-* Redirecting changes to streams from the Node.js project to this project.
-* Assisting in the implementation of stream providers within Node.js.
-* Recommending versions of `readable-stream` to be included in Node.js.
-* Messaging about the future of streams to give the community advance notice of
- changes.
-
-### [Build](https://github.com/nodejs/build)
-
-The Build Working Group's purpose is to create and maintain a distributed
-automation infrastructure.
-
-Responsibilities include:
-* Producing packages for all target platforms.
-* Running tests.
-* Running performance testing and comparisons.
-* Creating and managing build-containers.
-
-### [Diagnostics](https://github.com/nodejs/diagnostics)
-
-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.
-
-Responsibilities include:
-* Collaborating with V8 to integrate `v8_inspector` into Node.js.
-* Collaborating with V8 to integrate `trace_event` into Node.js.
-* Collaborating with Core to refine `async_wrap` and `async_hooks`.
-* Maintaining and improving OS trace system integration (e.g. ETW, LTTNG, dtrace).
-* Documenting diagnostic capabilities and APIs in Node.js and its components.
-* Exploring opportunities and gaps, discussing feature requests, and addressing
- conflicts in Node.js diagnostics.
-* Fostering an ecosystem of diagnostics tools for Node.js.
-
-### i18n
-
-The i18n Working Groups handle more than just translations. They
-are endpoints for community members to collaborate with each
-other in their language of choice.
-
-Each team is organized around a common spoken language. Each
-language community might then produce multiple localizations for
-various project resources.
-
-Responsibilities include:
-* Translating any Node.js materials they believe are relevant to their
- community.
-* Reviewing processes for keeping translations up to date and of high quality.
-* Managing and monitoring social media channels in their language.
-* Promoting Node.js speakers for meetups and conferences in their language.
-
-Note that the i18n Working Groups are distinct from the [Intl](#Intl) Working Group.
-
-Each language community maintains its own membership.
-
-* [nodejs-ar - Arabic (اللغة العربية)](https://github.com/nodejs/nodejs-ar)
-* [nodejs-bg - Bulgarian (български език)](https://github.com/nodejs/nodejs-bg)
-* [nodejs-bn - Bengali (বাংলা)](https://github.com/nodejs/nodejs-bn)
-* [nodejs-zh-CN - Chinese (中文)](https://github.com/nodejs/nodejs-zh-CN)
-* [nodejs-cs - Czech (Český Jazyk)](https://github.com/nodejs/nodejs-cs)
-* [nodejs-da - Danish (Dansk)](https://github.com/nodejs/nodejs-da)
-* [nodejs-de - German (Deutsch)](https://github.com/nodejs/nodejs-de)
-* [nodejs-el - Greek (Ελληνικά)](https://github.com/nodejs/nodejs-el)
-* [nodejs-es - Spanish (Español)](https://github.com/nodejs/nodejs-es)
-* [nodejs-fa - Persian (فارسی)](https://github.com/nodejs/nodejs-fa)
-* [nodejs-fi - Finnish (Suomi)](https://github.com/nodejs/nodejs-fi)
-* [nodejs-fr - French (Français)](https://github.com/nodejs/nodejs-fr)
-* [nodejs-he - Hebrew (עברית)](https://github.com/nodejs/nodejs-he)
-* [nodejs-hi - Hindi (फिजी बात)](https://github.com/nodejs/nodejs-hi)
-* [nodejs-hu - Hungarian (Magyar)](https://github.com/nodejs/nodejs-hu)
-* [nodejs-id - Indonesian (Bahasa Indonesia)](https://github.com/nodejs/nodejs-id)
-* [nodejs-it - Italian (Italiano)](https://github.com/nodejs/nodejs-it)
-* [nodejs-ja - Japanese (日本語)](https://github.com/nodejs/nodejs-ja)
-* [nodejs-ka - Georgian (ქართული)](https://github.com/nodejs/nodejs-ka)
-* [nodejs-ko - Korean (조선말)](https://github.com/nodejs/nodejs-ko)
-* [nodejs-mk - Macedonian (Mакедонски)](https://github.com/nodejs/nodejs-mk)
-* [nodejs-ms - Malay (بهاس ملايو)](https://github.com/nodejs/nodejs-ms)
-* [nodejs-nl - Dutch (Nederlands)](https://github.com/nodejs/nodejs-nl)
-* [nodejs-no - Norwegian (Norsk)](https://github.com/nodejs/nodejs-no)
-* [nodejs-pl - Polish (Język Polski)](https://github.com/nodejs/nodejs-pl)
-* [nodejs-pt - Portuguese (Português)](https://github.com/nodejs/nodejs-pt)
-* [nodejs-ro - Romanian (Română)](https://github.com/nodejs/nodejs-ro)
-* [nodejs-ru - Russian (Русский)](https://github.com/nodejs/nodejs-ru)
-* [nodejs-sv - Swedish (Svenska)](https://github.com/nodejs/nodejs-sv)
-* [nodejs-ta - Tamil (தமிழ்)](https://github.com/nodejs/nodejs-ta)
-* [nodejs-tr - Turkish (Türkçe)](https://github.com/nodejs/nodejs-tr)
-* [nodejs-zh-TW - Taiwanese (Hō-ló)](https://github.com/nodejs/nodejs-zh-TW)
-* [nodejs-uk - Ukrainian (Українська)](https://github.com/nodejs/nodejs-uk)
-* [nodejs-vi - Vietnamese (Tiếng Việtnam)](https://github.com/nodejs/nodejs-vi)
-
-### [Intl](https://github.com/nodejs/Intl)
-
-The Intl Working Group is dedicated to support and improvement of
-Internationalization (i18n) and Localization (l10n) in Node.
-
-Responsibilities include:
-* Ensuring functionality & compliance (standards: ECMA, Unicode…)
-* Supporting Globalization and Internationalization issues that come up
- in the tracker
-* Communicating guidance and best practices
-* Refining the existing `Intl` implementation
-
-The Intl Working Group is not responsible for translation of content. That is the
-responsibility of the specific [i18n](#i18n) group for each language.
-
-### [Evangelism](https://github.com/nodejs/evangelism)
-
-The Evangelism Working Group promotes the accomplishments
-of Node.js and lets the community know how they can get involved.
-
-Responsibilities include:
-* Facilitating project messaging.
-* Managing official project social media.
-* Handling the promotion of speakers for meetups and conferences.
-* Handling the promotion of community events.
-* Publishing regular update summaries and other promotional
- content.
-
-### [Docker](https://github.com/nodejs/docker-iojs)
-
-The Docker Working Group's purpose is to build, maintain, and improve official
-Docker images for the Node.js project.
-
-Responsibilities include:
-* Keeping the official Docker images updated in line with new Node.js releases.
-* Decide and implement image improvements and/or fixes.
-* Maintain and improve the images' documentation.
-
-### [Addon API](https://github.com/nodejs/nan)
-
-The Addon API Working Group is responsible for maintaining the NAN project and
-corresponding _nan_ package in npm. The NAN project makes available an
-abstraction layer for native add-on authors for Node.js,
-assisting in the writing of code that is compatible with many actively used
-versions of Node.js, V8 and libuv.
-
-Responsibilities include:
-* Maintaining the [NAN](https://github.com/nodejs/nan) GitHub repository,
- including code, issues and documentation.
-* Maintaining the [addon-examples](https://github.com/nodejs/node-addon-examples)
- GitHub repository, including code, issues and documentation.
-* Maintaining the C++ Addon API within the Node.js project, in subordination to
- the Node.js CTC.
-* Maintaining the Addon documentation within the Node.js project, in
- subordination to the Node.js CTC.
-* Maintaining the _nan_ package in npm, releasing new versions as appropriate.
-* Messaging about the future of the Node.js and NAN interface to give the
- community advance notice of changes.
-
-The current members can be found in their
-[README](https://github.com/nodejs/nan#collaborators).
-
-### [Benchmarking](https://github.com/nodejs/benchmarking)
-
-The purpose of the Benchmark Working Group is to gain consensus
-on an agreed set of benchmarks that can be used to:
-
-* track and evangelize performance gains made between Node.js releases
-* avoid performance regressions between releases
-
-Responsibilities include:
-* Identifying 1 or more benchmarks that reflect customer usage.
- Likely will need more than one to cover typical Node.js use cases
- including low-latency and high concurrency
-* Working to get community consensus on the list chosen
-* Adding regular execution of chosen benchmarks to Node.js builds
-* Tracking/publicizing performance between builds/releases
-
-### [Post-mortem](https://github.com/nodejs/post-mortem)
-
-The Post-mortem Diagnostics Working Group is dedicated to the support
-and improvement of postmortem debugging for Node.js. It seeks to
-elevate the role of postmortem debugging for Node, to assist in the
-development of techniques and tools, and to make techniques and tools
-known and available to Node.js users.
-
-Responsibilities include:
-* Defining and adding interfaces/APIs in order to allow dumps
- to be generated when needed.
-* Defining and adding common structures to the dumps generated
- in order to support tools that want to introspect those dumps.
-
-### [Documentation](https://github.com/nodejs/docs)
-
-The Documentation Working Group exists to support the improvement of Node.js
-documentation, both in the core API documentation, and elsewhere, such as the
-Node.js website. Its intent is to work closely with the Evangelism, Website, and
-Intl Working Groups to make excellent documentation available and accessible
-to all.
-
-Responsibilities include:
-* Defining and maintaining documentation style and content standards.
-* Producing documentation in a format acceptable for the Website Working Group
- to consume.
-* Ensuring that Node's documentation addresses a wide variety of audiences.
-* Creating and operating a process for documentation review that produces
- quality documentation and avoids impeding the progress of Core work.
-
-### [Testing](https://github.com/nodejs/testing)
-
-The Node.js Testing Working Group's purpose is to extend and improve testing of
-the Node.js source code.
-
-Responsibilities include:
-* Coordinating an overall strategy for improving testing.
-* Documenting guidelines around tests.
-* Working with the Build Working Group to improve continuous integration.
-* Improving tooling for testing.
-
diff --git a/benchmark/compare.R b/benchmark/compare.R
index 3f37cad74ad847..5085f4ea73b71a 100644
--- a/benchmark/compare.R
+++ b/benchmark/compare.R
@@ -47,7 +47,7 @@ statistics = ddply(dat, "name", function(subdat) {
p.value = NA;
confidence = 'NA';
- # Check if there is enough data to calulate the calculate the p-value
+ # Check if there is enough data to calculate the calculate the p-value
if (length(old.rate) > 1 && length(new.rate) > 1) {
# Perform a statistics test to see of there actually is a difference in
# performance.
diff --git a/benchmark/compare.js b/benchmark/compare.js
index af36d1c4239edf..a671bc9f3d7be6 100644
--- a/benchmark/compare.js
+++ b/benchmark/compare.js
@@ -9,7 +9,7 @@ const BenchmarkProgress = require('./_benchmark_progress.js');
// Parse arguments
//
const cli = CLI(`usage: ./node compare.js [options] [--] ...
- Run each benchmark in the directory many times using two diffrent
+ Run each benchmark in the directory many times using two different
node versions. More than one directory can be specified.
The output is formatted as csv, which can be processed using for
example 'compare.R'.
diff --git a/benchmark/os/cpus.js b/benchmark/os/cpus.js
new file mode 100644
index 00000000000000..2a8535113c207a
--- /dev/null
+++ b/benchmark/os/cpus.js
@@ -0,0 +1,17 @@
+'use strict';
+
+const common = require('../common.js');
+const cpus = require('os').cpus;
+
+const bench = common.createBenchmark(main, {
+ n: [3e4]
+});
+
+function main(conf) {
+ const n = +conf.n;
+
+ bench.start();
+ for (var i = 0; i < n; ++i)
+ cpus();
+ bench.end(n);
+}
diff --git a/configure b/configure
index 50078df43a9ed5..4bae197df3a021 100755
--- a/configure
+++ b/configure
@@ -503,7 +503,7 @@ def warn(msg):
prefix = '\033[1m\033[93mWARNING\033[0m' if os.isatty(1) else 'WARNING'
print('%s: %s' % (prefix, msg))
-# track if warnings occured
+# track if warnings occurred
warn.warned = False
def b(value):
@@ -576,11 +576,11 @@ def get_version_helper(cc, regexp):
def get_llvm_version(cc):
return get_version_helper(
- cc, r"(^clang version|based on LLVM) ([3-9]\.[0-9]+)")
+ cc, r"(^(?:FreeBSD )?clang version|based on LLVM) ([3-9]\.[0-9]+)")
def get_xcode_version(cc):
return get_version_helper(
- cc, r"(^Apple LLVM version) ([5-9]\.[0-9]+)")
+ cc, r"(^Apple LLVM version) ([5-9]\.[0-9]+)")
def get_gas_version(cc):
try:
diff --git a/deps/zlib/deflate.c b/deps/zlib/deflate.c
index 1ec761448de926..909606df01fb70 100644
--- a/deps/zlib/deflate.c
+++ b/deps/zlib/deflate.c
@@ -190,8 +190,11 @@ local const config configuration_table[10] = {
* prev[] will be initialized on the fly.
*/
#define CLEAR_HASH(s) \
- s->head[s->hash_size-1] = NIL; \
- zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
+ do { \
+ s->head[s->hash_size-1] = NIL; \
+ zmemzero((Bytef *)s->head, \
+ (unsigned)(s->hash_size-1)*sizeof(*s->head)); \
+ } while (0)
/* ===========================================================================
* Slide the hash table when sliding the window down (could be avoided with 32
diff --git a/doc/STYLE_GUIDE.md b/doc/STYLE_GUIDE.md
index 10f26421a4ceb5..f087718a6754fd 100644
--- a/doc/STYLE_GUIDE.md
+++ b/doc/STYLE_GUIDE.md
@@ -57,7 +57,7 @@
* When using underscores, asterisks and backticks please use proper escaping (**\\\_**, **\\\*** and **\\\`** instead of **\_**, **\*** and **\`**)
* References to constructor functions should use PascalCase
* References to constructor instances should be camelCased
-* References to methods should be used with parenthesis: `socket.end()` instead of `socket.end`
+* References to methods should be used with parentheses: `socket.end()` instead of `socket.end`
[plugin]: http://editorconfig.org/#download
[Oxford comma]: https://en.wikipedia.org/wiki/Serial_comma
diff --git a/doc/api/buffer.md b/doc/api/buffer.md
index 9aa7d0d9cbbbda..eda33fb7c27c19 100644
--- a/doc/api/buffer.md
+++ b/doc/api/buffer.md
@@ -38,11 +38,11 @@ const buf3 = Buffer.allocUnsafe(10);
// Creates a Buffer containing [0x1, 0x2, 0x3].
const buf4 = Buffer.from([1, 2, 3]);
-// Creates a Buffer containing ASCII bytes [0x74, 0x65, 0x73, 0x74].
-const buf5 = Buffer.from('test');
-
// Creates a Buffer containing UTF-8 bytes [0x74, 0xc3, 0xa9, 0x73, 0x74].
-const buf6 = Buffer.from('tést', 'utf8');
+const buf5 = Buffer.from('tést');
+
+// Creates a Buffer containing Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
+const buf6 = Buffer.from('tést', 'latin-1');
```
## `Buffer.from()`, `Buffer.alloc()`, and `Buffer.allocUnsafe()`
@@ -331,7 +331,7 @@ Allocates a new `Buffer` using an `array` of octets.
Example:
```js
-// Creates a new Buffer containing the ASCII bytes of the string 'buffer'
+// Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'
const buf = new Buffer([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
```
@@ -779,7 +779,7 @@ Allocates a new `Buffer` using an `array` of octets.
Example:
```js
-// Creates a new Buffer containing ASCII bytes of the string 'buffer'
+// Creates a new Buffer containing UTF-8 bytes of the string 'buffer'
const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
```
diff --git a/doc/api/cli.md b/doc/api/cli.md
index 538b1e06afdb12..89879cdc532937 100644
--- a/doc/api/cli.md
+++ b/doc/api/cli.md
@@ -382,7 +382,7 @@ When set, the well known "root" CAs (like VeriSign) will be extended with the
extra certificates in `file`. The file should consist of one or more trusted
certificates in PEM format. A message will be emitted (once) with
[`process.emitWarning()`][emit_warning] if the file is missing or
-misformatted, but any errors are otherwise ignored.
+malformed, but any errors are otherwise ignored.
Note that neither the well known nor extra certificates are used when the `ca`
options property is explicitly specified for a TLS or HTTPS client or server.
diff --git a/doc/api/console.md b/doc/api/console.md
index 45566a9cdf586d..cd538d73328615 100644
--- a/doc/api/console.md
+++ b/doc/api/console.md
@@ -66,6 +66,8 @@ const Console = console.Console;
```
### new Console(stdout[, stderr])
+* `stdout` {Writable}
+* `stderr` {Writable}
Creates a new `Console` by passing one or two writable stream instances.
`stdout` is a writable stream to print log or info output. `stderr`
@@ -94,6 +96,9 @@ new Console(process.stdout, process.stderr);
+* `value` {any}
+* `message` {any}
+* `...args` {any}
A simple assertion test that verifies whether `value` is truthy. If it is not,
an `AssertionError` is thrown. If provided, the error `message` is formatted
@@ -155,6 +160,11 @@ console.log('this will also print');
+* `obj` {any}
+* `options` {Object}
+ * `showHidden` {Boolean}
+ * `depth` {Number}
+ * `colors` {Boolean}
Uses [`util.inspect()`][] on `obj` and prints the resulting string to `stdout`.
This function bypasses any custom `inspect()` function defined on `obj`. An
@@ -176,6 +186,8 @@ Defaults to `false`. Colors are customizable; see
+* `data` {any}
+* `...args` {any}
Prints to `stderr` with newline. Multiple arguments can be passed, with the
first used as the primary message and all additional used as substitution
@@ -198,6 +210,8 @@ values are concatenated. See [`util.format()`][] for more information.
+* `data` {any}
+* `...args` {any}
The `console.info()` function is an alias for [`console.log()`][].
@@ -205,6 +219,8 @@ The `console.info()` function is an alias for [`console.log()`][].
+* `data` {any}
+* `...args` {any}
Prints to `stdout` with newline. Multiple arguments can be passed, with the
first used as the primary message and all additional used as substitution
@@ -227,6 +243,7 @@ values are concatenated. See [`util.format()`][] for more information.
+* `label` {String}
Starts a timer that can be used to compute the duration of an operation. Timers
are identified by a unique `label`. Use the same `label` when you call
@@ -242,6 +259,7 @@ changes:
description: This method no longer supports multiple calls that don’t map
to individual `console.time()` calls; see below for details.
-->
+* `label` {String}
Stops a timer that was previously started by calling [`console.time()`][] and
prints the result to `stdout`:
@@ -260,10 +278,12 @@ leaking it. On older versions, the timer persisted. This allowed
`console.timeEnd()` to be called multiple times for the same label. This
functionality was unintended and is no longer supported.*
-### console.trace(message[, ...args])
+### console.trace([message][, ...args])
+* `message` {any}
+* `...args` {any}
Prints to `stderr` the string `'Trace :'`, followed by the [`util.format()`][]
formatted message and stack trace to the current position in the code.
@@ -288,6 +308,8 @@ console.trace('Show me');
+* `data` {any}
+* `...args` {any}
The `console.warn()` function is an alias for [`console.error()`][].
diff --git a/doc/api/documentation.md b/doc/api/documentation.md
index 947010d951bdab..5f45c9b56ed387 100644
--- a/doc/api/documentation.md
+++ b/doc/api/documentation.md
@@ -56,12 +56,6 @@ The API has proven satisfactory. Compatibility with the npm ecosystem
is a high priority, and will not be broken unless absolutely necessary.
```
-```txt
-Stability: 3 - Locked
-Only bug fixes, security fixes, and performance improvements will be accepted.
-Please do not suggest API changes in this area; they will be refused.
-```
-
## JSON Output
> Stability: 1 - Experimental
diff --git a/doc/api/errors.md b/doc/api/errors.md
index 640935da35e460..e0e0f06ac5900f 100644
--- a/doc/api/errors.md
+++ b/doc/api/errors.md
@@ -141,15 +141,15 @@ the first argument will be passed as `null`.
const fs = require('fs');
function nodeStyleCallback(err, data) {
- if (err) {
- console.error('There was an error', err);
- return;
- }
- console.log(data);
+ if (err) {
+ console.error('There was an error', err);
+ return;
+ }
+ console.log(data);
}
fs.readFile('/some/file/that/does-not-exist', nodeStyleCallback);
-fs.readFile('/some/file/that/does-exist', nodeStyleCallback)
+fs.readFile('/some/file/that/does-exist', nodeStyleCallback);
```
The JavaScript `try / catch` mechanism **cannot** be used to intercept errors
@@ -167,15 +167,15 @@ try {
throw err;
}
});
-} catch(err) {
+} catch (err) {
// This will not catch the throw!
- console.log(err);
+ console.error(err);
}
```
This will not work because the callback function passed to `fs.readFile()` is
called asynchronously. By the time the callback has been called, the
-surrounding code (including the `try { } catch(err) { }` block will have
+surrounding code (including the `try { } catch (err) { }` block will have
already exited. Throwing an error inside the callback **can crash the Node.js
process** in most cases. If [domains][] are enabled, or a handler has been
registered with `process.on('uncaughtException')`, such errors can be
@@ -217,7 +217,7 @@ a string representing the location in the code at which
```js
const myObject = {};
Error.captureStackTrace(myObject);
-myObject.stack // similar to `new Error().stack`
+myObject.stack; // similar to `new Error().stack`
```
The first line of the trace, instead of being prefixed with `ErrorType:
@@ -238,7 +238,7 @@ function MyError() {
// Without passing MyError to captureStackTrace, the MyError
// frame would show up in the .stack property. By passing
// the constructor, we omit that frame and all frames above it.
-new MyError().stack
+new MyError().stack;
```
### Error.stackTraceLimit
@@ -255,7 +255,7 @@ will affect any stack trace captured *after* the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will
not capture any frames.
-#### error.message
+### error.message
* {String}
@@ -267,11 +267,11 @@ the stack trace of the `Error`, however changing this property after the
```js
const err = new Error('The message');
-console.log(err.message);
+console.error(err.message);
// Prints: The message
```
-#### error.stack
+### error.stack
* {String}
@@ -359,7 +359,7 @@ For example:
```js
require('net').connect(-1);
- // throws RangeError, port should be > 0 && < 65536
+ // throws "RangeError: "port" option should be >= 0 and < 65536: -1"
```
Node.js will generate and throw `RangeError` instances *immediately* as a form
@@ -379,19 +379,6 @@ doesNotExist;
// throws ReferenceError, doesNotExist is not a variable in this program.
```
-`ReferenceError` instances will have an `error.arguments` property whose value
-is an array containing a single element: a string representing the variable
-that was not defined.
-
-```js
-const assert = require('assert');
-try {
- doesNotExist;
-} catch(err) {
- assert(err.arguments[0], 'doesNotExist');
-}
-```
-
Unless an application is dynamically generating and running code,
`ReferenceError` instances should always be considered a bug in the code
or its dependencies.
@@ -407,7 +394,7 @@ program.
```js
try {
require('vm').runInThisContext('binary ! isNotOk');
-} catch(err) {
+} catch (err) {
// err will be a SyntaxError
}
```
diff --git a/doc/api/modules.md b/doc/api/modules.md
index 43bddab4faa310..0aeab0ad14bbd2 100644
--- a/doc/api/modules.md
+++ b/doc/api/modules.md
@@ -1,6 +1,6 @@
# Modules
-> Stability: 3 - Locked
+> Stability: 2 - Stable
diff --git a/doc/api/net.md b/doc/api/net.md
index f4669449ee0107..fe55ff486f6b19 100644
--- a/doc/api/net.md
+++ b/doc/api/net.md
@@ -340,7 +340,7 @@ Construct a new socket object.
`fd` allows you to specify the existing file descriptor of socket.
Set `readable` and/or `writable` to `true` to allow reads and/or writes on this
socket (NOTE: Works only when `fd` is passed).
-About `allowHalfOpen`, refer to `createServer()` and `'end'` event.
+About `allowHalfOpen`, refer to [`net.createServer()`][] and [`'end'`][] event.
`net.Socket` instances are [`EventEmitter`][] with the following events:
@@ -952,6 +952,7 @@ Returns true if input is a version 6 IP address, otherwise returns false.
[`dns.lookup()` hints]: dns.html#dns_supported_getaddrinfo_flags
[`end()`]: #net_socket_end_data_encoding
[`EventEmitter`]: events.html#events_class_eventemitter
+[`net.createServer()`]: #net_net_createserver_options_connectionlistener
[`net.Socket`]: #net_class_net_socket
[`pause()`]: #net_socket_pause
[`resume()`]: #net_socket_resume
diff --git a/doc/api/stream.md b/doc/api/stream.md
index 0e12e76c810c17..7756ddbef234a1 100644
--- a/doc/api/stream.md
+++ b/doc/api/stream.md
@@ -21,7 +21,7 @@ const stream = require('stream');
While it is important for all Node.js users to understand how streams work,
the `stream` module itself is most useful for developers that are creating new
-types of stream instances. Developer's who are primarily *consuming* stream
+types of stream instances. Developers who are primarily *consuming* stream
objects will rarely (if ever) have need to use the `stream` module directly.
## Organization of this Document
@@ -737,7 +737,7 @@ end
preferred over the use of the `'readable'` event.
##### readable.isPaused()
-
diff --git a/doc/api/timers.md b/doc/api/timers.md
index 75d6a36737b7d9..df48905001e19b 100644
--- a/doc/api/timers.md
+++ b/doc/api/timers.md
@@ -1,6 +1,6 @@
# Timers
-> Stability: 3 - Locked
+> Stability: 2 - Stable
The `timer` module exposes a global API for scheduling functions to
be called at some future period of time. Because the timer functions are
@@ -163,7 +163,7 @@ added: v0.0.1
Cancels a `Timeout` object created by [`setTimeout()`][].
-[the Node.js Event Loop]: https://github.com/nodejs/node/blob/master/doc/topics/event-loop-timers-and-nexttick.md
+[the Node.js Event Loop]: https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick
[`TypeError`]: errors.html#errors_class_typeerror
[`clearImmediate()`]: timers.html#timers_clearimmediate_immediate
[`clearInterval()`]: timers.html#timers_clearinterval_timeout
diff --git a/doc/api/url.md b/doc/api/url.md
index c7bc6d5dbbe2f1..5104c575396853 100644
--- a/doc/api/url.md
+++ b/doc/api/url.md
@@ -599,7 +599,7 @@ Gets and sets the protocol portion of the URL.
```js
const myURL = new URL('https://example.org');
console.log(myURL.protocol);
- // Prints http:
+ // Prints https:
myURL.protocol = 'ftp';
console.log(myURL.href);
@@ -876,14 +876,27 @@ for (const [name, value] of params) {
// xyz baz
```
-### require('url').domainToAscii(domain)
+### require('url').domainToASCII(domain)
* `domain` {String}
* Returns: {String}
-Returns the [Punycode][] ASCII serialization of the `domain`.
+Returns the [Punycode][] ASCII serialization of the `domain`. If `domain` is an
+invalid domain, the empty string is returned.
-*Note*: The `require('url').domainToAscii()` method is introduced as part of
+It performs the inverse operation to [`require('url').domainToUnicode()`][].
+
+```js
+const url = require('url');
+console.log(url.domainToASCII('español.com'));
+ // Prints xn--espaol-zwa.com
+console.log(url.domainToASCII('中文.com'));
+ // Prints xn--fiq228c.com
+console.log(url.domainToASCII('xn--iñvalid.com'));
+ // Prints an empty string
+```
+
+*Note*: The `require('url').domainToASCII()` method is introduced as part of
the new `URL` implementation but is not part of the WHATWG URL standard.
### require('url').domainToUnicode(domain)
@@ -891,7 +904,20 @@ the new `URL` implementation but is not part of the WHATWG URL standard.
* `domain` {String}
* Returns: {String}
-Returns the Unicode serialization of the `domain`.
+Returns the Unicode serialization of the `domain`. If `domain` is an invalid
+domain, the empty string is returned.
+
+It performs the inverse operation to [`require('url').domainToASCII()`][].
+
+```js
+const url = require('url');
+console.log(url.domainToUnicode('xn--espaol-zwa.com'));
+ // Prints español.com
+console.log(url.domainToUnicode('xn--fiq228c.com'));
+ // Prints 中文.com
+console.log(url.domainToUnicode('xn--iñvalid.com'));
+ // Prints an empty string
+```
*Note*: The `require('url').domainToUnicode()` API is introduced as part of the
the new `URL` implementation but is not part of the WHATWG URL standard.
@@ -956,6 +982,8 @@ console.log(myURL.origin);
[`URLSearchParams`]: #url_class_urlsearchparams
[`urlSearchParams.entries()`]: #url_urlsearchparams_entries
[`urlSearchParams@@iterator()`]: #url_urlsearchparams_iterator
+[`require('url').domainToASCII()`]: #url_require_url_domaintoascii_domain
+[`require('url').domainToUnicode()`]: #url_require_url_domaintounicode_domain
[stable sorting algorithm]: https://en.wikipedia.org/wiki/Sorting_algorithm#Stability
[`JSON.stringify()`]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
[`url.toJSON()`]: #url_url_tojson
diff --git a/doc/api_assets/dnt_helper.js b/doc/api_assets/dnt_helper.js
index f255d916c2df32..9906db4f276cd7 100644
--- a/doc/api_assets/dnt_helper.js
+++ b/doc/api_assets/dnt_helper.js
@@ -26,7 +26,7 @@ function _dntEnabled(dnt, userAgent) {
var fxMatch = ua.match(/Firefox\/(\d+)/);
var ieRegEx = /MSIE|Trident/i;
var isIE = ieRegEx.test(ua);
- // Matches from Windows up to the first occurance of ; un-greedily
+ // Matches from Windows up to the first occurrence of ; un-greedily
// http://www.regexr.com/3c2el
var platform = ua.match(/Windows.+?(?=;)/g);
diff --git a/doc/changelogs/CHANGELOG_ARCHIVE.md b/doc/changelogs/CHANGELOG_ARCHIVE.md
index 797317ea43fe81..7a643ca5c3a397 100644
--- a/doc/changelogs/CHANGELOG_ARCHIVE.md
+++ b/doc/changelogs/CHANGELOG_ARCHIVE.md
@@ -3025,7 +3025,7 @@ https://github.com/nodejs/node/commit/311d7dee19034ff1c6bc9098c36973b8d687eaba
* After V8 heap is compact, don't use a timer every 2 seconds.
* Improve nextTick implementation.
- * Add primative support for Upgrading HTTP connections.
+ * Add primitive support for Upgrading HTTP connections.
(See commit log for docs 760bba5)
* Add timeout and maxBuffer options to child_process.exec
diff --git a/doc/changelogs/CHANGELOG_V5.md b/doc/changelogs/CHANGELOG_V5.md
index aa69d93f7ce180..5fefbcc81a6b85 100644
--- a/doc/changelogs/CHANGELOG_V5.md
+++ b/doc/changelogs/CHANGELOG_V5.md
@@ -215,7 +215,7 @@ This is a security release. All Node.js users should consult the security releas
### Notable changes
**http**:
- * Enclose IPv6 Host header in square brackets. This will enable proper separation of the host adress from any port reference (Mihai Potra) [#5314](https://github.com/nodejs/node/pull/5314)
+ * Enclose IPv6 Host header in square brackets. This will enable proper separation of the host address from any port reference (Mihai Potra) [#5314](https://github.com/nodejs/node/pull/5314)
**path**:
* Make win32.isAbsolute more consistent (Brian White) [#6028](https://github.com/nodejs/node/pull/6028)
diff --git a/doc/changelogs/CHANGELOG_V7.md b/doc/changelogs/CHANGELOG_V7.md
index 2b63c5a07c6abf..53c6b345ba4cfe 100644
--- a/doc/changelogs/CHANGELOG_V7.md
+++ b/doc/changelogs/CHANGELOG_V7.md
@@ -29,6 +29,65 @@
* [io.js](CHANGELOG_IOJS.md)
* [Archive](CHANGELOG_ARCHIVE.md)
+
+## 2017-03-08, Version 7.7.2 (Current), @evanlucas
+
+### Notable changes
+
+* **doc**: add `Daijiro Wachi` to collaborators (Daijiro Wachi) [#11676](https://github.com/nodejs/node/pull/11676)
+* **tty**: add ref() so process.stdin.ref() etc. work (Ben Schmidt) [#7360](https://github.com/nodejs/node/pull/7360)
+* **util**: fix inspecting symbol key in string (Ali BARIN) [#11672](https://github.com/nodejs/node/pull/11672)
+
+### Commits
+
+* [[`f56ca30bf0`](https://github.com/nodejs/node/commit/f56ca30bf0)] - **benchmark,build,doc,lib,src,test**: correct typos (Benjamin Fleischer) [#11189](https://github.com/nodejs/node/pull/11189)
+* [[`02dbae6b3f`](https://github.com/nodejs/node/commit/02dbae6b3f)] - **buffer**: refactor Buffer.prototype.inspect() (Rich Trott) [#11600](https://github.com/nodejs/node/pull/11600)
+* [[`e5b530cb62`](https://github.com/nodejs/node/commit/e5b530cb62)] - **build**: fix llvm version detection in freebsd-10 (Shigeki Ohtsu) [#11668](https://github.com/nodejs/node/pull/11668)
+* [[`ed6d7412a7`](https://github.com/nodejs/node/commit/ed6d7412a7)] - **deps**: fix CLEAR_HASH macro to be usable as a single statement (Sam Roberts) [#11616](https://github.com/nodejs/node/pull/11616)
+* [[`039a1a97d8`](https://github.com/nodejs/node/commit/039a1a97d8)] - **dns**: minor refactor of dns module (James M Snell) [#11597](https://github.com/nodejs/node/pull/11597)
+* [[`3b27b8da9d`](https://github.com/nodejs/node/commit/3b27b8da9d)] - **doc**: fixed readable.isPaused() version annotation (Laurent Fortin) [#11677](https://github.com/nodejs/node/pull/11677)
+* [[`84028888db`](https://github.com/nodejs/node/commit/84028888db)] - **doc**: fix broken URL to event loop guide (Poker) [#11670](https://github.com/nodejs/node/pull/11670)
+* [[`d5c436311c`](https://github.com/nodejs/node/commit/d5c436311c)] - **doc**: remove Locked from stability index (Rich Trott) [#11661](https://github.com/nodejs/node/pull/11661)
+* [[`986d391066`](https://github.com/nodejs/node/commit/986d391066)] - **doc**: unlock module (Rich Trott) [#11661](https://github.com/nodejs/node/pull/11661)
+* [[`d06dbf03cc`](https://github.com/nodejs/node/commit/d06dbf03cc)] - **doc**: fix misleading ASCII comments (Rahat Ahmed) [#11657](https://github.com/nodejs/node/pull/11657)
+* [[`98d33282d9`](https://github.com/nodejs/node/commit/98d33282d9)] - **doc**: add `Daijiro Wachi` to collaborators (Daijiro Wachi) [#11676](https://github.com/nodejs/node/pull/11676)
+* [[`3e79dffd2c`](https://github.com/nodejs/node/commit/3e79dffd2c)] - **doc**: fix WHATWG URL url.protocol example (Richard Lau) [#11647](https://github.com/nodejs/node/pull/11647)
+* [[`e468cd3ee7`](https://github.com/nodejs/node/commit/e468cd3ee7)] - **doc**: argument types for console methods (Amelia Clarke) [#11554](https://github.com/nodejs/node/pull/11554)
+* [[`83c7b245e2`](https://github.com/nodejs/node/commit/83c7b245e2)] - **doc**: fix typo in stream doc (Bradley Curran) [#11560](https://github.com/nodejs/node/pull/11560)
+* [[`a0c117ba95`](https://github.com/nodejs/node/commit/a0c117ba95)] - **doc**: fixup errors.md (Vse Mozhet Byt) [#11566](https://github.com/nodejs/node/pull/11566)
+* [[`b116830d64`](https://github.com/nodejs/node/commit/b116830d64)] - **doc**: add link to references in net.Socket (Joyee Cheung) [#11625](https://github.com/nodejs/node/pull/11625)
+* [[`b968491dc2`](https://github.com/nodejs/node/commit/b968491dc2)] - **doc**: document WHATWG IDNA methods' error handling (Timothy Gu) [#11549](https://github.com/nodejs/node/pull/11549)
+* [[`d329abf1c6`](https://github.com/nodejs/node/commit/d329abf1c6)] - **doc**: use common malformed instead of misformatted (James Sumners) [#11518](https://github.com/nodejs/node/pull/11518)
+* [[`11aea2662f`](https://github.com/nodejs/node/commit/11aea2662f)] - **doc**: fix typo in STYLE_GUIDE.md (Nikolai Vavilov) [#11615](https://github.com/nodejs/node/pull/11615)
+* [[`f972bd81c6`](https://github.com/nodejs/node/commit/f972bd81c6)] - **inspector**: libuv notification on incoming message (Eugene Ostroukhov) [#11617](https://github.com/nodejs/node/pull/11617)
+* [[`a7eba9c71c`](https://github.com/nodejs/node/commit/a7eba9c71c)] - **meta**: move WORKING_GROUPS.md to CTC repo (James M Snell) [#11555](https://github.com/nodejs/node/pull/11555)
+* [[`5963566367`](https://github.com/nodejs/node/commit/5963566367)] - **meta**: remove out of date ROADMAP.md file (James M Snell) [#11556](https://github.com/nodejs/node/pull/11556)
+* [[`b56e851c48`](https://github.com/nodejs/node/commit/b56e851c48)] - **net**: refactor overloaded argument handling (Joyee Cheung) [#11667](https://github.com/nodejs/node/pull/11667)
+* [[`13cb8a69e4`](https://github.com/nodejs/node/commit/13cb8a69e4)] - **net**: remove misleading comment (Ben Noordhuis) [#11573](https://github.com/nodejs/node/pull/11573)
+* [[`e2133f3e57`](https://github.com/nodejs/node/commit/e2133f3e57)] - **os**: improve cpus() performance (Brian White) [#11564](https://github.com/nodejs/node/pull/11564)
+* [[`821d713a38`](https://github.com/nodejs/node/commit/821d713a38)] - **src**: remove outdated FIXME in node_crypto.cc (Daniel Bevenius) [#11669](https://github.com/nodejs/node/pull/11669)
+* [[`1b6ba9effb`](https://github.com/nodejs/node/commit/1b6ba9effb)] - **src**: do not ignore IDNA conversion error (Timothy Gu) [#11549](https://github.com/nodejs/node/pull/11549)
+* [[`fdb4a6c796`](https://github.com/nodejs/node/commit/fdb4a6c796)] - **test**: skip the test with proper TAP message (Sakthipriyan Vairamani (thefourtheye)) [#11584](https://github.com/nodejs/node/pull/11584)
+* [[`5df9110178`](https://github.com/nodejs/node/commit/5df9110178)] - **test**: check the origin of the blob URLs (Daijiro Wachi) [#11426](https://github.com/nodejs/node/pull/11426)
+* [[`b4dcb26681`](https://github.com/nodejs/node/commit/b4dcb26681)] - **test**: changed test1 of test-vm-timeout.js (maurice_hayward) [#11590](https://github.com/nodejs/node/pull/11590)
+* [[`f69685be65`](https://github.com/nodejs/node/commit/f69685be65)] - **test**: remove obsolete eslint-disable comment (Rich Trott) [#11643](https://github.com/nodejs/node/pull/11643)
+* [[`a4d14363a9`](https://github.com/nodejs/node/commit/a4d14363a9)] - **test**: fix args in parallel/test-fs-null-bytes.js (Vse Mozhet Byt) [#11601](https://github.com/nodejs/node/pull/11601)
+* [[`8377374754`](https://github.com/nodejs/node/commit/8377374754)] - **test**: fix tests when npn feature is disabled. (Shigeki Ohtsu) [#11655](https://github.com/nodejs/node/pull/11655)
+* [[`1445e282c3`](https://github.com/nodejs/node/commit/1445e282c3)] - **test**: add test-buffer-prototype-inspect (Rich Trott) [#11600](https://github.com/nodejs/node/pull/11600)
+* [[`00dd20c173`](https://github.com/nodejs/node/commit/00dd20c173)] - **test**: fix flaky test-https-agent-create-connection (Santiago Gimeno) [#11649](https://github.com/nodejs/node/pull/11649)
+* [[`91a222de99`](https://github.com/nodejs/node/commit/91a222de99)] - **test**: enable max-len for test-repl (Rich Trott) [#11559](https://github.com/nodejs/node/pull/11559)
+* [[`924b785d50`](https://github.com/nodejs/node/commit/924b785d50)] - **test**: fix test-internal-util-assertCrypto regex (Daniel Bevenius) [#11620](https://github.com/nodejs/node/pull/11620)
+* [[`cdee945307`](https://github.com/nodejs/node/commit/cdee945307)] - **test**: improve https coverage to check create connection (chiaki-yokoo) [#11435](https://github.com/nodejs/node/pull/11435)
+* [[`4f9253686d`](https://github.com/nodejs/node/commit/4f9253686d)] - **test**: apply strict mode in test-repl (Rich Trott) [#11575](https://github.com/nodejs/node/pull/11575)
+* [[`2601c06486`](https://github.com/nodejs/node/commit/2601c06486)] - **test**: skip tests with common.skip (Sakthipriyan Vairamani (thefourtheye)) [#11585](https://github.com/nodejs/node/pull/11585)
+* [[`6a5d96164a`](https://github.com/nodejs/node/commit/6a5d96164a)] - **test**: more comprehensive IDNA test cases (Timothy Gu) [#11549](https://github.com/nodejs/node/pull/11549)
+* [[`163d2d1624`](https://github.com/nodejs/node/commit/163d2d1624)] - **timers**: unlock the timers API (Rich Trott) [#11580](https://github.com/nodejs/node/pull/11580)
+* [[`d6ac192fa3`](https://github.com/nodejs/node/commit/d6ac192fa3)] - **tls**: fix macro to check NPN feature (Shigeki Ohtsu) [#11655](https://github.com/nodejs/node/pull/11655)
+* [[`ac3deb1481`](https://github.com/nodejs/node/commit/ac3deb1481)] - **tools**: remove NODE_PATH from environment for tests (Rich Trott) [#11612](https://github.com/nodejs/node/pull/11612)
+* [[`3c54f8199c`](https://github.com/nodejs/node/commit/3c54f8199c)] - **tty**: add ref() so process.stdin.ref() etc. work (Ben Schmidt) [#7360](https://github.com/nodejs/node/pull/7360)
+* [[`24e6fcce8b`](https://github.com/nodejs/node/commit/24e6fcce8b)] - **url**: use `hasIntl` instead of `try-catch` (Daijiro Wachi) [#11571](https://github.com/nodejs/node/pull/11571)
+* [[`7b84363636`](https://github.com/nodejs/node/commit/7b84363636)] - **util**: fix inspecting symbol key in string (Ali BARIN) [#11672](https://github.com/nodejs/node/pull/11672)
+
## 2017-03-01, Version 7.7.1 (Current), @italoacasas
diff --git a/lib/buffer.js b/lib/buffer.js
index 21e24c2980f5e6..27e2b5393e7de0 100644
--- a/lib/buffer.js
+++ b/lib/buffer.js
@@ -521,12 +521,10 @@ Buffer.prototype.equals = function equals(b) {
Buffer.prototype[internalUtil.customInspectSymbol] = function inspect() {
var str = '';
var max = exports.INSPECT_MAX_BYTES;
- if (this.length > 0) {
- str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');
- if (this.length > max)
- str += ' ... ';
- }
- return '<' + this.constructor.name + ' ' + str + '>';
+ str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();
+ if (this.length > max)
+ str += ' ... ';
+ return `<${this.constructor.name} ${str}>`;
};
Buffer.prototype.inspect = Buffer.prototype[internalUtil.customInspectSymbol];
diff --git a/lib/dns.js b/lib/dns.js
index cfa04ed192050f..1f22c91c78c27a 100644
--- a/lib/dns.js
+++ b/lib/dns.js
@@ -99,7 +99,7 @@ function onlookupall(err, addresses) {
// Easy DNS A/AAAA look up
// lookup(hostname, [options,] callback)
-exports.lookup = function lookup(hostname, options, callback) {
+function lookup(hostname, options, callback) {
var hints = 0;
var family = -1;
var all = false;
@@ -119,9 +119,9 @@ exports.lookup = function lookup(hostname, options, callback) {
all = options.all === true;
if (hints !== 0 &&
- hints !== exports.ADDRCONFIG &&
- hints !== exports.V4MAPPED &&
- hints !== (exports.ADDRCONFIG | exports.V4MAPPED)) {
+ hints !== cares.AI_ADDRCONFIG &&
+ hints !== cares.AI_V4MAPPED &&
+ hints !== (cares.AI_ADDRCONFIG | cares.AI_V4MAPPED)) {
throw new TypeError('Invalid argument: hints must use valid flags');
}
} else {
@@ -166,7 +166,7 @@ exports.lookup = function lookup(hostname, options, callback) {
callback.immediately = true;
return req;
-};
+}
function onlookupservice(err, host, service) {
@@ -178,7 +178,7 @@ function onlookupservice(err, host, service) {
// lookupService(address, port, callback)
-exports.lookupService = function lookupService(host, port, callback) {
+function lookupService(host, port, callback) {
if (arguments.length !== 3)
throw new Error('Invalid arguments');
@@ -205,7 +205,7 @@ exports.lookupService = function lookupService(host, port, callback) {
callback.immediately = true;
return req;
-};
+}
function onresolve(err, result, ttls) {
@@ -251,26 +251,25 @@ function resolver(bindingName) {
var resolveMap = Object.create(null);
-exports.resolve4 = resolveMap.A = resolver('queryA');
-exports.resolve6 = resolveMap.AAAA = resolver('queryAaaa');
-exports.resolveCname = resolveMap.CNAME = resolver('queryCname');
-exports.resolveMx = resolveMap.MX = resolver('queryMx');
-exports.resolveNs = resolveMap.NS = resolver('queryNs');
-exports.resolveTxt = resolveMap.TXT = resolver('queryTxt');
-exports.resolveSrv = resolveMap.SRV = resolver('querySrv');
-exports.resolvePtr = resolveMap.PTR = resolver('queryPtr');
-exports.resolveNaptr = resolveMap.NAPTR = resolver('queryNaptr');
-exports.resolveSoa = resolveMap.SOA = resolver('querySoa');
-exports.reverse = resolver('getHostByAddr');
-
-
-exports.resolve = function resolve(hostname, type_, callback_) {
+resolveMap.A = resolver('queryA');
+resolveMap.AAAA = resolver('queryAaaa');
+resolveMap.CNAME = resolver('queryCname');
+resolveMap.MX = resolver('queryMx');
+resolveMap.NS = resolver('queryNs');
+resolveMap.TXT = resolver('queryTxt');
+resolveMap.SRV = resolver('querySrv');
+resolveMap.PTR = resolver('queryPtr');
+resolveMap.NAPTR = resolver('queryNaptr');
+resolveMap.SOA = resolver('querySoa');
+
+
+function resolve(hostname, type_, callback_) {
var resolver, callback;
if (typeof type_ === 'string') {
resolver = resolveMap[type_];
callback = callback_;
} else if (typeof type_ === 'function') {
- resolver = exports.resolve4;
+ resolver = resolveMap.A;
callback = type_;
} else {
throw new Error('"type" argument must be a string');
@@ -281,15 +280,15 @@ exports.resolve = function resolve(hostname, type_, callback_) {
} else {
throw new Error(`Unknown type "${type_}"`);
}
-};
+}
-exports.getServers = function getServers() {
+function getServers() {
return cares.getServers();
-};
+}
-exports.setServers = function setServers(servers) {
+function setServers(servers) {
// cache the original servers because in the event of an error setting the
// servers cares won't have any servers available for resolution
const orig = cares.getServers();
@@ -326,34 +325,53 @@ exports.setServers = function setServers(servers) {
var err = cares.strerror(errorNumber);
throw new Error(`c-ares failed to set servers: "${err}" [${servers}]`);
}
-};
+}
-// uv_getaddrinfo flags
-exports.ADDRCONFIG = cares.AI_ADDRCONFIG;
-exports.V4MAPPED = cares.AI_V4MAPPED;
-
-// ERROR CODES
-exports.NODATA = 'ENODATA';
-exports.FORMERR = 'EFORMERR';
-exports.SERVFAIL = 'ESERVFAIL';
-exports.NOTFOUND = 'ENOTFOUND';
-exports.NOTIMP = 'ENOTIMP';
-exports.REFUSED = 'EREFUSED';
-exports.BADQUERY = 'EBADQUERY';
-exports.BADNAME = 'EBADNAME';
-exports.BADFAMILY = 'EBADFAMILY';
-exports.BADRESP = 'EBADRESP';
-exports.CONNREFUSED = 'ECONNREFUSED';
-exports.TIMEOUT = 'ETIMEOUT';
-exports.EOF = 'EOF';
-exports.FILE = 'EFILE';
-exports.NOMEM = 'ENOMEM';
-exports.DESTRUCTION = 'EDESTRUCTION';
-exports.BADSTR = 'EBADSTR';
-exports.BADFLAGS = 'EBADFLAGS';
-exports.NONAME = 'ENONAME';
-exports.BADHINTS = 'EBADHINTS';
-exports.NOTINITIALIZED = 'ENOTINITIALIZED';
-exports.LOADIPHLPAPI = 'ELOADIPHLPAPI';
-exports.ADDRGETNETWORKPARAMS = 'EADDRGETNETWORKPARAMS';
-exports.CANCELLED = 'ECANCELLED';
+module.exports = {
+ lookup,
+ lookupService,
+ getServers,
+ setServers,
+ resolve,
+ resolve4: resolveMap.A,
+ resolve6: resolveMap.AAAA,
+ resolveCname: resolveMap.CNAME,
+ resolveMx: resolveMap.MX,
+ resolveNs: resolveMap.NS,
+ resolveTxt: resolveMap.TXT,
+ resolveSrv: resolveMap.SRV,
+ resolvePtr: resolveMap.PTR,
+ resolveNaptr: resolveMap.NAPTR,
+ resolveSoa: resolveMap.SOA,
+ reverse: resolver('getHostByAddr'),
+
+ // uv_getaddrinfo flags
+ ADDRCONFIG: cares.AI_ADDRCONFIG,
+ V4MAPPED: cares.AI_V4MAPPED,
+
+ // ERROR CODES
+ NODATA: 'ENODATA',
+ FORMERR: 'EFORMERR',
+ SERVFAIL: 'ESERVFAIL',
+ NOTFOUND: 'ENOTFOUND',
+ NOTIMP: 'ENOTIMP',
+ REFUSED: 'EREFUSED',
+ BADQUERY: 'EBADQUERY',
+ BADNAME: 'EBADNAME',
+ BADFAMILY: 'EBADFAMILY',
+ BADRESP: 'EBADRESP',
+ CONNREFUSED: 'ECONNREFUSED',
+ TIMEOUT: 'ETIMEOUT',
+ EOF: 'EOF',
+ FILE: 'EFILE',
+ NOMEM: 'ENOMEM',
+ DESTRUCTION: 'EDESTRUCTION',
+ BADSTR: 'EBADSTR',
+ BADFLAGS: 'EBADFLAGS',
+ NONAME: 'ENONAME',
+ BADHINTS: 'EBADHINTS',
+ NOTINITIALIZED: 'ENOTINITIALIZED',
+ LOADIPHLPAPI: 'ELOADIPHLPAPI',
+ ADDRGETNETWORKPARAMS: 'EADDRGETNETWORKPARAMS',
+ CANCELLED: 'ECANCELLED'
+};
diff --git a/lib/net.js b/lib/net.js
index 2528daedc84ef5..018b58b941f100 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -24,7 +24,6 @@ var cluster;
const errnoException = util._errnoException;
const exceptionWithHostPort = util._exceptionWithHostPort;
const isLegalPort = internalNet.isLegalPort;
-const assertPort = internalNet.assertPort;
function noop() {}
@@ -60,37 +59,50 @@ exports.createServer = function(options, connectionListener) {
// connect(path, [cb]);
//
exports.connect = exports.createConnection = function() {
- var args = new Array(arguments.length);
+ const args = new Array(arguments.length);
for (var i = 0; i < arguments.length; i++)
args[i] = arguments[i];
- args = normalizeArgs(args);
- debug('createConnection', args);
- var s = new Socket(args[0]);
+ // TODO(joyeecheung): use destructuring when V8 is fast enough
+ const normalized = normalizeArgs(args);
+ const options = normalized[0];
+ const cb = normalized[1];
+ debug('createConnection', normalized);
+ const socket = new Socket(options);
- if (args[0].timeout) {
- s.setTimeout(args[0].timeout);
+ if (options.timeout) {
+ socket.setTimeout(options.timeout);
}
- return Socket.prototype.connect.apply(s, args);
+ return Socket.prototype.connect.call(socket, options, cb);
};
-// Returns an array [options, cb], where cb can be null.
-// It is the same as the argument of Socket.prototype.connect().
-// This is used by Server.prototype.listen() and Socket.prototype.connect().
-function normalizeArgs(args) {
- var options = {};
+// Returns an array [options, cb], where options is an object,
+// cb is either a funciton or null.
+// Used to normalize arguments of Socket.prototype.connect() and
+// Server.prototype.listen(). Possible combinations of paramters:
+// (options[...][, cb])
+// (path[...][, cb])
+// ([port][, host][...][, cb])
+// For Socket.prototype.connect(), the [...] part is ignored
+// For Server.prototype.listen(), the [...] part is [, backlog]
+// but will not be handled here (handled in listen())
+function normalizeArgs(args) {
if (args.length === 0) {
- return [options];
- } else if (args[0] !== null && typeof args[0] === 'object') {
- // connect(options, [cb])
- options = args[0];
- } else if (isPipeName(args[0])) {
- // connect(path, [cb]);
- options.path = args[0];
+ return [{}, null];
+ }
+
+ const arg0 = args[0];
+ var options = {};
+ if (typeof arg0 === 'object' && arg0 !== null) {
+ // (options[...][, cb])
+ options = arg0;
+ } else if (isPipeName(arg0)) {
+ // (path[...][, cb])
+ options.path = arg0;
} else {
- // connect(port, [host], [cb])
- options.port = args[0];
+ // ([port][, host][...][, cb])
+ options.port = arg0;
if (args.length > 1 && typeof args[1] === 'string') {
options.host = args[1];
}
@@ -98,8 +110,9 @@ function normalizeArgs(args) {
var cb = args[args.length - 1];
if (typeof cb !== 'function')
- cb = null;
- return [options, cb];
+ return [options, null];
+ else
+ return [options, cb];
}
exports._normalizeArgs = normalizeArgs;
@@ -208,10 +221,6 @@ Socket.prototype._unrefTimer = function _unrefTimer() {
// the user has called .end(), and all the bytes have been
// sent out to the other side.
-// If allowHalfOpen is false, or if the readable side has
-// ended already, then destroy.
-// If allowHalfOpen is true, then we need to do a shutdown,
-// so that only the writable side will be cleaned up.
function onSocketFinish() {
// If still connecting - defer handling 'finish' until 'connect' will happen
if (this.connecting) {
@@ -896,13 +905,16 @@ Socket.prototype.connect = function(options, cb) {
if (options === null || typeof options !== 'object') {
// Old API:
- // connect(port, [host], [cb])
- // connect(path, [cb]);
- var args = new Array(arguments.length);
+ // connect(port[, host][, cb])
+ // connect(path[, cb]);
+ const args = new Array(arguments.length);
for (var i = 0; i < arguments.length; i++)
args[i] = arguments[i];
- args = normalizeArgs(args);
- return Socket.prototype.connect.apply(this, args);
+ const normalized = normalizeArgs(args);
+ const normalizedOptions = normalized[0];
+ const normalizedCb = normalized[1];
+ return Socket.prototype.connect.call(this,
+ normalizedOptions, normalizedCb);
}
if (this.destroyed) {
@@ -927,7 +939,7 @@ Socket.prototype.connect = function(options, cb) {
initSocketHandle(this);
}
- if (typeof cb === 'function') {
+ if (cb !== null) {
this.once('connect', cb);
}
@@ -1337,57 +1349,73 @@ function listen(self, address, port, addressType, backlog, fd, exclusive) {
Server.prototype.listen = function() {
- var args = new Array(arguments.length);
+ const args = new Array(arguments.length);
for (var i = 0; i < arguments.length; i++)
args[i] = arguments[i];
- var [options, cb] = normalizeArgs(args);
+ // TODO(joyeecheung): use destructuring when V8 is fast enough
+ const normalized = normalizeArgs(args);
+ var options = normalized[0];
+ const cb = normalized[1];
- if (typeof cb === 'function') {
+ var hasCallback = (cb !== null);
+ if (hasCallback) {
this.once('listening', cb);
}
-
- if (args.length === 0 || typeof args[0] === 'function') {
- // Bind to a random port.
- options.port = 0;
- }
-
- // The third optional argument is the backlog size.
- // When the ip is omitted it can be the second argument.
- var backlog = toNumber(args.length > 1 && args[1]) ||
- toNumber(args.length > 2 && args[2]);
+ const backlogFromArgs =
+ // (handle, backlog) or (path, backlog) or (port, backlog)
+ toNumber(args.length > 1 && args[1]) ||
+ toNumber(args.length > 2 && args[2]); // (port, host, backlog)
options = options._handle || options.handle || options;
-
+ // (handle[, backlog][, cb]) where handle is an object with a handle
if (options instanceof TCP) {
this._handle = options;
- listen(this, null, -1, -1, backlog);
- } else if (typeof options.fd === 'number' && options.fd >= 0) {
- listen(this, null, null, null, backlog, options.fd);
- } else {
- backlog = options.backlog || backlog;
-
- if (typeof options.port === 'number' || typeof options.port === 'string' ||
- (typeof options.port === 'undefined' && 'port' in options)) {
- // Undefined is interpreted as zero (random port) for consistency
- // with net.connect().
- assertPort(options.port);
- if (options.host) {
- lookupAndListen(this, options.port | 0, options.host, backlog,
- options.exclusive);
- } else {
- listen(this, null, options.port | 0, 4, backlog, undefined,
- options.exclusive);
- }
- } else if (options.path && isPipeName(options.path)) {
- // UNIX socket or Windows pipe.
- const pipeName = this._pipeName = options.path;
- listen(this, pipeName, -1, -1, backlog, undefined, options.exclusive);
- } else {
- throw new Error('Invalid listen argument: ' + options);
+ listen(this, null, -1, -1, backlogFromArgs);
+ return this;
+ }
+ // (handle[, backlog][, cb]) where handle is an object with a fd
+ if (typeof options.fd === 'number' && options.fd >= 0) {
+ listen(this, null, null, null, backlogFromArgs, options.fd);
+ return this;
+ }
+
+ // ([port][, host][, backlog][, cb]) where port is omitted,
+ // that is, listen() or listen(cb),
+ // or (options[, cb]) where options.port is explicitly set as undefined,
+ // bind to an arbitrary unused port
+ if (args.length === 0 || typeof args[0] === 'function' ||
+ (typeof options.port === 'undefined' && 'port' in options)) {
+ options.port = 0;
+ }
+ // ([port][, host][, backlog][, cb]) where port is specified
+ // or (options[, cb]) where options.port is specified
+ // or if options.port is normalized as 0 before
+ if (typeof options.port === 'number' || typeof options.port === 'string') {
+ if (!isLegalPort(options.port)) {
+ throw new RangeError('"port" argument must be >= 0 and < 65536');
+ }
+ const backlog = options.backlog || backlogFromArgs;
+ // start TCP server listening on host:port
+ if (options.host) {
+ lookupAndListen(this, options.port | 0, options.host, backlog,
+ options.exclusive);
+ } else { // Undefined host, listens on unspecified address
+ listen(this, null, options.port | 0, 4, // addressType will be ignored
+ backlog, undefined, options.exclusive);
}
+ return this;
}
- return this;
+ // (path[, backlog][, cb]) or (options[, cb])
+ // where path or options.path is a UNIX domain socket or Windows pipe
+ if (options.path && isPipeName(options.path)) {
+ const pipeName = this._pipeName = options.path;
+ const backlog = options.backlog || backlogFromArgs;
+ listen(this, pipeName, -1, -1, backlog, undefined, options.exclusive);
+ return this;
+ }
+
+ throw new Error('Invalid listen argument: ' + options);
};
function lookupAndListen(self, port, address, backlog, exclusive) {
diff --git a/lib/os.js b/lib/os.js
index 6d8ebd1ca55659..b2b960ea63d029 100644
--- a/lib/os.js
+++ b/lib/os.js
@@ -1,7 +1,9 @@
'use strict';
const binding = process.binding('os');
+const getCPUs = binding.getCPUs;
const getLoadAvg = binding.getLoadAvg;
+const pushValToArrayMax = process.binding('util').pushValToArrayMax;
const constants = process.binding('constants').os;
const internalUtil = require('internal/util');
const isWindows = process.platform === 'win32';
@@ -10,7 +12,6 @@ exports.hostname = binding.getHostname;
exports.uptime = binding.getUptime;
exports.freemem = binding.getFreeMem;
exports.totalmem = binding.getTotalMem;
-exports.cpus = binding.getCPUs;
exports.type = binding.getOSType;
exports.release = binding.getOSRelease;
exports.networkInterfaces = binding.getInterfaceAddresses;
@@ -23,6 +24,26 @@ exports.loadavg = function loadavg() {
return [avgValues[0], avgValues[1], avgValues[2]];
};
+const cpuValues = new Float64Array(6 * pushValToArrayMax);
+function addCPUInfo() {
+ for (var i = 0, c = 0; i < arguments.length; ++i, c += 6) {
+ this[this.length] = {
+ model: arguments[i],
+ speed: cpuValues[c],
+ times: {
+ user: cpuValues[c + 1],
+ nice: cpuValues[c + 2],
+ sys: cpuValues[c + 3],
+ idle: cpuValues[c + 4],
+ irq: cpuValues[c + 5]
+ }
+ };
+ }
+}
+exports.cpus = function cpus() {
+ return getCPUs(addCPUInfo, cpuValues, []);
+};
+
Object.defineProperty(exports, 'constants', {
configurable: false,
enumerable: true,
diff --git a/lib/url.js b/lib/url.js
index 845f22a44447d6..cc098593a5f238 100644
--- a/lib/url.js
+++ b/lib/url.js
@@ -1,15 +1,7 @@
'use strict';
-function importPunycode() {
- try {
- return process.binding('icu');
- } catch (e) {
- return require('punycode');
- }
-}
-
-const { toASCII } = importPunycode();
-
+const { toASCII } = process.binding('config').hasIntl ?
+ process.binding('icu') : require('punycode');
const { StorageObject, hexTable } = require('internal/querystring');
const internalUrl = require('internal/url');
exports.parse = urlParse;
@@ -319,7 +311,10 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
// It only converts parts of the domain name that
// have non-ASCII characters, i.e. it doesn't matter if
// you call it with a domain that already is ASCII-only.
- this.hostname = toASCII(this.hostname);
+
+ // Use lenient mode (`true`) to try to support even non-compliant
+ // URLs.
+ this.hostname = toASCII(this.hostname, true);
}
var p = this.port ? ':' + this.port : '';
diff --git a/lib/util.js b/lib/util.js
index 64c4c94c29a81f..8c880c674b5ad3 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -396,6 +396,10 @@ function formatValue(ctx, value, recurseTimes) {
// for boxed Strings, we have to remove the 0-n indexed entries,
// since they just noisy up the output and are redundant
keys = keys.filter(function(key) {
+ if (typeof key === 'symbol') {
+ return true;
+ }
+
return !(key >= 0 && key < raw.length);
});
}
diff --git a/src/debug-agent.cc b/src/debug-agent.cc
index 2d8ed8afc980ec..2ce8381fc51462 100644
--- a/src/debug-agent.cc
+++ b/src/debug-agent.cc
@@ -182,7 +182,7 @@ void Agent::WorkerRun() {
CHECK_EQ(&child_loop_, env.event_loop());
uv_run(&child_loop_, UV_RUN_DEFAULT);
- // Clean-up peristent
+ // Clean-up persistent
api_.Reset();
}
isolate->Dispose();
diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc
index ae2e666384b5af..229bdfa36c6f55 100644
--- a/src/inspector_agent.cc
+++ b/src/inspector_agent.cc
@@ -159,6 +159,7 @@ class AgentImpl {
static void ThreadCbIO(void* agent);
static void WriteCbIO(uv_async_t* async);
+ static void MainThreadAsyncCb(uv_async_t* req);
void InstallInspectorOnProcess();
@@ -190,6 +191,7 @@ class AgentImpl {
node::Environment* parent_env_;
uv_async_t io_thread_req_;
+ uv_async_t main_thread_req_;
V8NodeInspector* inspector_;
v8::Platform* platform_;
MessageQueue incoming_message_queue_;
@@ -334,6 +336,9 @@ AgentImpl::AgentImpl(Environment* env) : delegate_(nullptr),
dispatching_messages_(false),
session_id_(0),
server_(nullptr) {
+ CHECK_EQ(0, uv_async_init(env->event_loop(), &main_thread_req_,
+ AgentImpl::MainThreadAsyncCb));
+ uv_unref(reinterpret_cast(&main_thread_req_));
CHECK_EQ(0, uv_sem_init(&start_sem_, 0));
memset(&io_thread_req_, 0, sizeof(io_thread_req_));
}
@@ -416,10 +421,7 @@ bool AgentImpl::Start(v8::Platform* platform, const char* path,
InstallInspectorOnProcess();
- int err = uv_loop_init(&child_loop_);
- CHECK_EQ(err, 0);
-
- err = uv_thread_create(&thread_, AgentImpl::ThreadCbIO, this);
+ int err = uv_thread_create(&thread_, AgentImpl::ThreadCbIO, this);
CHECK_EQ(err, 0);
uv_sem_wait(&start_sem_);
@@ -606,6 +608,7 @@ void AgentImpl::PostIncomingMessage(InspectorAction action, int session_id,
platform_->CallOnForegroundThread(isolate,
new DispatchOnInspectorBackendTask(this));
isolate->RequestInterrupt(InterruptCallback, this);
+ CHECK_EQ(0, uv_async_send(&main_thread_req_));
}
NotifyMessageReceived();
}
@@ -662,6 +665,12 @@ void AgentImpl::DispatchMessages() {
dispatching_messages_ = false;
}
+// static
+void AgentImpl::MainThreadAsyncCb(uv_async_t* req) {
+ AgentImpl* agent = node::ContainerOf(&AgentImpl::main_thread_req_, req);
+ agent->DispatchMessages();
+}
+
void AgentImpl::Write(TransportAction action, int session_id,
const StringView& inspector_message) {
AppendMessage(&outgoing_message_queue_, action, session_id,
diff --git a/src/node.cc b/src/node.cc
index 25cd87defcf9e1..35d29bda93eea8 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -2892,7 +2892,7 @@ static Local
+
+
pseudo-tty
+
Yes
+
Tests that require stdin/stdout/stderr to be a TTY.
+
pummel
No
diff --git a/test/fixtures/url-idna.js b/test/fixtures/url-idna.js
new file mode 100644
index 00000000000000..af169bb04a8736
--- /dev/null
+++ b/test/fixtures/url-idna.js
@@ -0,0 +1,217 @@
+'use strict';
+
+// Credit for list: http://www.i18nguy.com/markup/idna-examples.html
+module.exports = {
+ valid: [
+ { ascii: 'xn--mgbaal8b0b9b2b.icom.museum',
+ unicode: 'افغانستا.icom.museum'
+ },
+ {
+ ascii: 'xn--lgbbat1ad8j.icom.museum',
+ unicode: 'الجزائر.icom.museum'
+ },
+ {
+ ascii: 'xn--sterreich-z7a.icom.museum',
+ unicode: 'österreich.icom.museum'
+ },
+ {
+ ascii: 'xn--54b6eqazv8bc7e.icom.museum',
+ unicode: 'বাংলাদেশ.icom.museum'
+ },
+ {
+ ascii: 'xn--80abmy0agn7e.icom.museum',
+ unicode: 'беларусь.icom.museum'
+ },
+ {
+ ascii: 'xn--belgi-rsa.icom.museum',
+ unicode: 'belgië.icom.museum'
+ },
+ {
+ ascii: 'xn--80abgvm6a7d2b.icom.museum',
+ unicode: 'българия.icom.museum'
+ },
+ {
+ ascii: 'xn--mgbfqim.icom.museum',
+ unicode: 'تشادر.icom.museum'
+ },
+ {
+ ascii: 'xn--fiqs8s.icom.museum',
+ unicode: '中国.icom.museum'
+ },
+ {
+ ascii: 'xn--mgbu4chg.icom.museum',
+ unicode: 'القمر.icom.museum'
+ },
+ {
+ ascii: 'xn--vxakcego.icom.museum',
+ unicode: 'κυπρος.icom.museum'
+ },
+ {
+ ascii: 'xn--eskrepublika-ebb62d.icom.museum',
+ unicode: 'českárepublika.icom.museum'
+ },
+ {
+ ascii: 'xn--wgbh1c.icom.museum',
+ unicode: 'مصر.icom.museum'
+ },
+ {
+ ascii: 'xn--hxakic4aa.icom.museum',
+ unicode: 'ελλάδα.icom.museum'
+ },
+ {
+ ascii: 'xn--magyarorszg-t7a.icom.museum',
+ unicode: 'magyarország.icom.museum'
+ },
+ {
+ ascii: 'xn--sland-ysa.icom.museum',
+ unicode: 'ísland.icom.museum'
+ },
+ {
+ ascii: 'xn--h2brj9c.icom.museum',
+ unicode: 'भारत.icom.museum'
+ },
+ {
+ ascii: 'xn--mgba3a4fra.icom.museum',
+ unicode: 'ايران.icom.museum'
+ },
+ {
+ ascii: 'xn--ire-9la.icom.museum',
+ unicode: 'éire.icom.museum'
+ },
+ {
+ ascii: 'xn--4dbklr2c8d.xn--4dbrk0ce.museum',
+ unicode: 'איקו״ם.ישראל.museum'
+ },
+ {
+ ascii: 'xn--wgv71a.icom.museum',
+ unicode: '日本.icom.museum'
+ },
+ {
+ ascii: 'xn--igbhzh7gpa.icom.museum',
+ unicode: 'الأردن.icom.museum'
+ },
+ {
+ ascii: 'xn--80aaa0a6awh12ed.icom.museum',
+ unicode: 'қазақстан.icom.museum'
+ },
+ {
+ ascii: 'xn--3e0b707e.icom.museum',
+ unicode: '한국.icom.museum'
+ },
+ {
+ ascii: 'xn--80afmksoji0fc.icom.museum',
+ unicode: 'кыргызстан.icom.museum'
+ },
+ {
+ ascii: 'xn--q7ce6a.icom.museum',
+ unicode: 'ລາວ.icom.museum'
+ },
+ {
+ ascii: 'xn--mgbb7fjb.icom.museum',
+ unicode: 'لبنان.icom.museum'
+ },
+ {
+ ascii: 'xn--80aaldqjmmi6x.icom.museum',
+ unicode: 'македонија.icom.museum'
+ },
+ {
+ ascii: 'xn--mgbah1a3hjkrd.icom.museum',
+ unicode: 'موريتانيا.icom.museum'
+ },
+ {
+ ascii: 'xn--mxico-bsa.icom.museum',
+ unicode: 'méxico.icom.museum'
+ },
+ {
+ ascii: 'xn--c1aqabffc0aq.icom.museum',
+ unicode: 'монголулс.icom.museum'
+ },
+ {
+ ascii: 'xn--mgbc0a9azcg.icom.museum',
+ unicode: 'المغرب.icom.museum'
+ },
+ {
+ ascii: 'xn--l2bey1c2b.icom.museum',
+ unicode: 'नेपाल.icom.museum'
+ },
+ {
+ ascii: 'xn--mgb9awbf.icom.museum',
+ unicode: 'عمان.icom.museum'
+ },
+ {
+ ascii: 'xn--wgbl6a.icom.museum',
+ unicode: 'قطر.icom.museum'
+ },
+ {
+ ascii: 'xn--romnia-yta.icom.museum',
+ unicode: 'românia.icom.museum'
+ },
+ {
+ ascii: 'xn--h1alffa9f.xn--h1aegh.museum',
+ unicode: 'россия.иком.museum'
+ },
+ {
+ ascii: 'xn--80aaabm1ab4blmeec9e7n.xn--h1aegh.museum',
+ unicode: 'србијаицрнагора.иком.museum'
+ },
+ {
+ ascii: 'xn--xkc2al3hye2a.icom.museum',
+ unicode: 'இலங்கை.icom.museum'
+ },
+ {
+ ascii: 'xn--espaa-rta.icom.museum',
+ unicode: 'españa.icom.museum'
+ },
+ {
+ ascii: 'xn--o3cw4h.icom.museum',
+ unicode: 'ไทย.icom.museum'
+ },
+ {
+ ascii: 'xn--pgbs0dh.icom.museum',
+ unicode: 'تونس.icom.museum'
+ },
+ {
+ ascii: 'xn--trkiye-3ya.icom.museum',
+ unicode: 'türkiye.icom.museum'
+ },
+ {
+ ascii: 'xn--80aaxgrpt.icom.museum',
+ unicode: 'украина.icom.museum'
+ },
+ {
+ ascii: 'xn--vitnam-jk8b.icom.museum',
+ unicode: 'việtnam.icom.museum'
+ },
+ // long URL
+ {
+ ascii: `${`${'a'.repeat(63)}.`.repeat(3)}com`,
+ unicode: `${`${'a'.repeat(63)}.`.repeat(3)}com`
+ }
+ ],
+ invalid: [
+ // long label
+ {
+ url: `${'a'.repeat(64)}.com`,
+ mode: 'ascii'
+ },
+ // long URL
+ {
+ url: `${`${'a'.repeat(63)}.`.repeat(4)}com`,
+ mode: 'ascii'
+ },
+ // invalid character
+ {
+ url: '\ufffd.com',
+ mode: 'ascii'
+ },
+ {
+ url: '\ufffd.com',
+ mode: 'unicode'
+ },
+ // invalid Punycode
+ {
+ url: 'xn---abc.com',
+ mode: 'unicode'
+ }
+ ]
+}
diff --git a/test/fixtures/url-tests.js b/test/fixtures/url-tests.js
index 3b162391cd2ef5..0e510eb366d0f2 100644
--- a/test/fixtures/url-tests.js
+++ b/test/fixtures/url-tests.js
@@ -3589,17 +3589,17 @@ module.exports =
"base": "http://other.com/",
"failure": true
},
- // "U+FFFD",
- // {
- // "input": "https://\ufffd",
- // "base": "about:blank",
- // "failure": true
- // },
- // {
- // "input": "https://%EF%BF%BD",
- // "base": "about:blank",
- // "failure": true
- // },
+ "U+FFFD",
+ {
+ "input": "https://\ufffd",
+ "base": "about:blank",
+ "failure": true
+ },
+ {
+ "input": "https://%EF%BF%BD",
+ "base": "about:blank",
+ "failure": true
+ },
{
"input": "https://x/\ufffd?\ufffd#\ufffd",
"base": "about:blank",
@@ -4497,26 +4497,26 @@ module.exports =
"hash": ""
},
"# Hosts and percent-encoding",
- // {
- // "input": "ftp://example.com%80/",
- // "base": "about:blank",
- // "failure": true
- // },
- // {
- // "input": "ftp://example.com%A0/",
- // "base": "about:blank",
- // "failure": true
- // },
- // {
- // "input": "https://example.com%80/",
- // "base": "about:blank",
- // "failure": true
- // },
- // {
- // "input": "https://example.com%A0/",
- // "base": "about:blank",
- // "failure": true
- // },
+ {
+ "input": "ftp://example.com%80/",
+ "base": "about:blank",
+ "failure": true
+ },
+ {
+ "input": "ftp://example.com%A0/",
+ "base": "about:blank",
+ "failure": true
+ },
+ {
+ "input": "https://example.com%80/",
+ "base": "about:blank",
+ "failure": true
+ },
+ {
+ "input": "https://example.com%A0/",
+ "base": "about:blank",
+ "failure": true
+ },
{
"input": "ftp://%e2%98%83",
"base": "about:blank",
@@ -5622,5 +5622,33 @@ module.exports =
"input": "non-special://[:80/",
"base": "about:blank",
"failure": true
+ },
+ {
+ "input": "blob:https://example.com:443/",
+ "base": "about:blank",
+ "href": "blob:https://example.com:443/",
+ "protocol": "blob:",
+ "username": "",
+ "password": "",
+ "host": "",
+ "hostname": "",
+ "port": "",
+ "pathname": "https://example.com:443/",
+ "search": "",
+ "hash": ""
+ },
+ {
+ "input": "blob:d3958f5c-0777-0845-9dcf-2cb28783acaf",
+ "base": "about:blank",
+ "href": "blob:d3958f5c-0777-0845-9dcf-2cb28783acaf",
+ "protocol": "blob:",
+ "username": "",
+ "password": "",
+ "host": "",
+ "hostname": "",
+ "port": "",
+ "pathname": "d3958f5c-0777-0845-9dcf-2cb28783acaf",
+ "search": "",
+ "hash": ""
}
]
diff --git a/test/inspector/inspector-helper.js b/test/inspector/inspector-helper.js
index 3f3fe17e2e043e..beaf1a8aa1a3fd 100644
--- a/test/inspector/inspector-helper.js
+++ b/test/inspector/inspector-helper.js
@@ -427,9 +427,24 @@ Harness.prototype.expectShutDown = function(errorCode) {
});
};
-exports.startNodeForInspectorTest = function(callback) {
- const child = spawn(process.execPath,
- [ '--inspect-brk', mainScript ]);
+Harness.prototype.kill = function() {
+ return this.enqueue_((callback) => {
+ this.process_.kill();
+ callback();
+ });
+};
+
+exports.startNodeForInspectorTest = function(callback,
+ inspectorFlag = '--inspect-brk',
+ opt_script_contents) {
+ const args = [inspectorFlag];
+ if (opt_script_contents) {
+ args.push('-e', opt_script_contents);
+ } else {
+ args.push(mainScript);
+ }
+
+ const child = spawn(process.execPath, args);
const timeoutId = timeout('Child process did not start properly', 4);
diff --git a/test/inspector/test-not-blocked-on-idle.js b/test/inspector/test-not-blocked-on-idle.js
new file mode 100644
index 00000000000000..6d32888b44b802
--- /dev/null
+++ b/test/inspector/test-not-blocked-on-idle.js
@@ -0,0 +1,20 @@
+'use strict';
+require('../common');
+const helper = require('./inspector-helper.js');
+
+function shouldShutDown(session) {
+ session
+ .sendInspectorCommands([
+ { 'method': 'Debugger.enable' },
+ { 'method': 'Debugger.pause' },
+ ])
+ .disconnect(true);
+}
+
+function runTests(harness) {
+ // 1 second wait to make sure the inferior began running the script
+ setTimeout(() => harness.runFrontendSession([shouldShutDown]).kill(), 1000);
+}
+
+const script = 'setInterval(() => {debugger;}, 60000);';
+helper.startNodeForInspectorTest(runTests, '--inspect', script);
diff --git a/test/internet/test-dgram-broadcast-multi-process.js b/test/internet/test-dgram-broadcast-multi-process.js
index da3bd8cceb74e3..8414e558bab6d1 100644
--- a/test/internet/test-dgram-broadcast-multi-process.js
+++ b/test/internet/test-dgram-broadcast-multi-process.js
@@ -227,7 +227,7 @@ if (process.argv[2] === 'child') {
listenSocket.on('close', function() {
//HACK: Wait to exit the process to ensure that the parent
//process has had time to receive all messages via process.send()
- //This may be indicitave of some other issue.
+ //This may be indicative of some other issue.
setTimeout(function() {
process.exit();
}, 1000);
diff --git a/test/parallel/test-buffer-prototype-inspect.js b/test/parallel/test-buffer-prototype-inspect.js
new file mode 100644
index 00000000000000..5f65a9bb288f16
--- /dev/null
+++ b/test/parallel/test-buffer-prototype-inspect.js
@@ -0,0 +1,23 @@
+'use strict';
+require('../common');
+
+// lib/buffer.js defines Buffer.prototype.inspect() to override how buffers are
+// presented by util.inspect().
+
+const assert = require('assert');
+const util = require('util');
+
+{
+ const buf = Buffer.from('fhqwhgads');
+ assert.strictEqual(util.inspect(buf), '');
+}
+
+{
+ const buf = Buffer.from('');
+ assert.strictEqual(util.inspect(buf), '');
+}
+
+{
+ const buf = Buffer.from('x'.repeat(51));
+ assert.ok(/^$/.test(util.inspect(buf)));
+}
diff --git a/test/parallel/test-child-process-fork-dgram.js b/test/parallel/test-child-process-fork-dgram.js
index 4447c54cae8f0c..37b40dccd3f369 100644
--- a/test/parallel/test-child-process-fork-dgram.js
+++ b/test/parallel/test-child-process-fork-dgram.js
@@ -63,7 +63,7 @@ if (process.argv[2] === 'child') {
const timer = setInterval(function() {
/*
* Both the parent and the child got at least one message,
- * test passed, clean up everyting.
+ * test passed, clean up everything.
*/
if (parentGotMessage && childGotMessage) {
clearInterval(timer);
diff --git a/test/parallel/test-cluster-message.js b/test/parallel/test-cluster-message.js
index 5b537bbe73a755..0b699093821b82 100644
--- a/test/parallel/test-cluster-message.js
+++ b/test/parallel/test-cluster-message.js
@@ -102,7 +102,7 @@ if (cluster.isWorker) {
if (data.code === 'received message') {
check('worker', data.echo === 'message from master');
} else {
- throw new Error('wrong TCP message recived: ' + data);
+ throw new Error('wrong TCP message received: ' + data);
}
});
diff --git a/test/parallel/test-cluster-setup-master-multiple.js b/test/parallel/test-cluster-setup-master-multiple.js
index 25cff7cb33e0c1..c8fefddc39a23e 100644
--- a/test/parallel/test-cluster-setup-master-multiple.js
+++ b/test/parallel/test-cluster-setup-master-multiple.js
@@ -6,7 +6,7 @@ const cluster = require('cluster');
assert(cluster.isMaster);
// The cluster.settings object is cloned even though the current implementation
-// makes that unecessary. This is to make the test less fragile if the
+// makes that unnecessary. This is to make the test less fragile if the
// implementation ever changes such that cluster.settings is mutated instead of
// replaced.
function cheapClone(obj) {
diff --git a/test/parallel/test-crypto-authenticated.js b/test/parallel/test-crypto-authenticated.js
index 245783fb1b4275..1a628023b5c46e 100644
--- a/test/parallel/test-crypto-authenticated.js
+++ b/test/parallel/test-crypto-authenticated.js
@@ -318,7 +318,7 @@ for (const i in TEST_CASES) {
}
if (common.hasFipsCrypto && test.iv.length < 24) {
- console.log('1..0 # Skipped: IV len < 12 bytes unsupported in FIPS mode');
+ common.skip('IV len < 12 bytes unsupported in FIPS mode');
continue;
}
diff --git a/test/parallel/test-crypto-binary-default.js b/test/parallel/test-crypto-binary-default.js
index 6ee3aeac36dd89..7dbd5e41639a38 100644
--- a/test/parallel/test-crypto-binary-default.js
+++ b/test/parallel/test-crypto-binary-default.js
@@ -477,7 +477,7 @@ function testCipher2(key) {
function testCipher3(key, iv) {
- // Test encyrption and decryption with explicit key and iv
+ // Test encryption and decryption with explicit key and iv
const plaintext =
'32|RmVZZkFUVmpRRkp0TmJaUm56ZU9qcnJkaXNNWVNpTTU*|iXmckfRWZBGWWELw' +
'eCBsThSsfUHLeRe0KCsK8ooHgxie0zOINpXxfZi/oNG7uq9JWFVCk70gfzQH8ZUJ' +
@@ -496,7 +496,7 @@ function testCipher3(key, iv) {
function testCipher4(key, iv) {
- // Test encyrption and decryption with explicit key and iv
+ // Test encryption and decryption with explicit key and iv
const plaintext =
'32|RmVZZkFUVmpRRkp0TmJaUm56ZU9qcnJkaXNNWVNpTTU*|iXmckfRWZBGWWELw' +
'eCBsThSsfUHLeRe0KCsK8ooHgxie0zOINpXxfZi/oNG7uq9JWFVCk70gfzQH8ZUJ' +
diff --git a/test/parallel/test-crypto-cipheriv-decipheriv.js b/test/parallel/test-crypto-cipheriv-decipheriv.js
index 6f22dbe71affb1..a03a25d511fe16 100644
--- a/test/parallel/test-crypto-cipheriv-decipheriv.js
+++ b/test/parallel/test-crypto-cipheriv-decipheriv.js
@@ -9,7 +9,7 @@ if (!common.hasCrypto) {
const crypto = require('crypto');
function testCipher1(key, iv) {
- // Test encyrption and decryption with explicit key and iv
+ // Test encryption and decryption with explicit key and iv
const plaintext =
'32|RmVZZkFUVmpRRkp0TmJaUm56ZU9qcnJkaXNNWVNpTTU*|iXmckfRWZBGWWELw' +
'eCBsThSsfUHLeRe0KCsK8ooHgxie0zOINpXxfZi/oNG7uq9JWFVCk70gfzQH8ZUJ' +
@@ -41,7 +41,7 @@ function testCipher1(key, iv) {
function testCipher2(key, iv) {
- // Test encyrption and decryption with explicit key and iv
+ // Test encryption and decryption with explicit key and iv
const plaintext =
'32|RmVZZkFUVmpRRkp0TmJaUm56ZU9qcnJkaXNNWVNpTTU*|iXmckfRWZBGWWELw' +
'eCBsThSsfUHLeRe0KCsK8ooHgxie0zOINpXxfZi/oNG7uq9JWFVCk70gfzQH8ZUJ' +
diff --git a/test/parallel/test-event-emitter-add-listeners.js b/test/parallel/test-event-emitter-add-listeners.js
index 33125daabdb3b3..81af3fd50c8b50 100644
--- a/test/parallel/test-event-emitter-add-listeners.js
+++ b/test/parallel/test-event-emitter-add-listeners.js
@@ -5,8 +5,8 @@ const EventEmitter = require('events');
{
const ee = new EventEmitter();
- const events_new_listener_emited = [];
- const listeners_new_listener_emited = [];
+ const events_new_listener_emitted = [];
+ const listeners_new_listener_emitted = [];
// Sanity check
assert.strictEqual(ee.addListener, ee.on);
@@ -16,8 +16,8 @@ const EventEmitter = require('events');
if (event === 'newListener')
return;
- events_new_listener_emited.push(event);
- listeners_new_listener_emited.push(listener);
+ events_new_listener_emitted.push(event);
+ listeners_new_listener_emitted.push(listener);
});
const hello = common.mustCall(function(a, b) {
@@ -33,8 +33,8 @@ const EventEmitter = require('events');
ee.on('hello', hello);
ee.once('foo', common.fail);
- assert.deepStrictEqual(['hello', 'foo'], events_new_listener_emited);
- assert.deepStrictEqual([hello, common.fail], listeners_new_listener_emited);
+ assert.deepStrictEqual(['hello', 'foo'], events_new_listener_emitted);
+ assert.deepStrictEqual([hello, common.fail], listeners_new_listener_emitted);
ee.emit('hello', 'a', 'b');
}
diff --git a/test/parallel/test-fs-access.js b/test/parallel/test-fs-access.js
index b03bf572f6a5bd..d5934dd614ec04 100644
--- a/test/parallel/test-fs-access.js
+++ b/test/parallel/test-fs-access.js
@@ -32,11 +32,11 @@ createFileWithPerms(readWriteFile, 0o666);
*
* There's not really any point in resetting the process' user id to 0 after
* changing it to 'nobody', since in the case that the test runs without
- * superuser priviledge, it is not possible to change its process user id to
+ * superuser privilege, it is not possible to change its process user id to
* superuser.
*
* It can prevent the test from removing files created before the change of user
- * id, but that's fine. In this case, it is the responsability of the
+ * id, but that's fine. In this case, it is the responsibility of the
* continuous integration platform to take care of that.
*/
let hasWriteAccessForReadonlyFile = false;
diff --git a/test/parallel/test-fs-null-bytes.js b/test/parallel/test-fs-null-bytes.js
index c56c8ff7cea4ff..522a1591e63962 100644
--- a/test/parallel/test-fs-null-bytes.js
+++ b/test/parallel/test-fs-null-bytes.js
@@ -23,7 +23,7 @@ function check(async, sync) {
check(fs.access, fs.accessSync, 'foo\u0000bar');
check(fs.access, fs.accessSync, 'foo\u0000bar', fs.F_OK);
-check(fs.appendFile, fs.appendFileSync, 'foo\u0000bar');
+check(fs.appendFile, fs.appendFileSync, 'foo\u0000bar', 'abc');
check(fs.chmod, fs.chmodSync, 'foo\u0000bar', '0644');
check(fs.chown, fs.chownSync, 'foo\u0000bar', 12, 34);
check(fs.link, fs.linkSync, 'foo\u0000bar', 'foobar');
@@ -47,14 +47,14 @@ check(null, fs.unwatchFile, 'foo\u0000bar', common.mustNotCall());
check(fs.utimes, fs.utimesSync, 'foo\u0000bar', 0, 0);
check(null, fs.watch, 'foo\u0000bar', common.mustNotCall());
check(null, fs.watchFile, 'foo\u0000bar', common.mustNotCall());
-check(fs.writeFile, fs.writeFileSync, 'foo\u0000bar');
+check(fs.writeFile, fs.writeFileSync, 'foo\u0000bar', 'abc');
const fileUrl = new URL('file:///C:/foo\u0000bar');
const fileUrl2 = new URL('file:///C:/foo%00bar');
check(fs.access, fs.accessSync, fileUrl);
check(fs.access, fs.accessSync, fileUrl, fs.F_OK);
-check(fs.appendFile, fs.appendFileSync, fileUrl);
+check(fs.appendFile, fs.appendFileSync, fileUrl, 'abc');
check(fs.chmod, fs.chmodSync, fileUrl, '0644');
check(fs.chown, fs.chownSync, fileUrl, 12, 34);
check(fs.link, fs.linkSync, fileUrl, 'foobar');
@@ -78,11 +78,11 @@ check(null, fs.unwatchFile, fileUrl, common.fail);
check(fs.utimes, fs.utimesSync, fileUrl, 0, 0);
check(null, fs.watch, fileUrl, common.fail);
check(null, fs.watchFile, fileUrl, common.fail);
-check(fs.writeFile, fs.writeFileSync, fileUrl);
+check(fs.writeFile, fs.writeFileSync, fileUrl, 'abc');
check(fs.access, fs.accessSync, fileUrl2);
check(fs.access, fs.accessSync, fileUrl2, fs.F_OK);
-check(fs.appendFile, fs.appendFileSync, fileUrl2);
+check(fs.appendFile, fs.appendFileSync, fileUrl2, 'abc');
check(fs.chmod, fs.chmodSync, fileUrl2, '0644');
check(fs.chown, fs.chownSync, fileUrl2, 12, 34);
check(fs.link, fs.linkSync, fileUrl2, 'foobar');
@@ -106,7 +106,7 @@ check(null, fs.unwatchFile, fileUrl2, common.fail);
check(fs.utimes, fs.utimesSync, fileUrl2, 0, 0);
check(null, fs.watch, fileUrl2, common.fail);
check(null, fs.watchFile, fileUrl2, common.fail);
-check(fs.writeFile, fs.writeFileSync, fileUrl2);
+check(fs.writeFile, fs.writeFileSync, fileUrl2, 'abc');
// an 'error' for exists means that it doesn't exist.
// one of many reasons why this file is the absolute worst.
diff --git a/test/parallel/test-handle-wrap-isrefed-tty.js b/test/parallel/test-handle-wrap-isrefed-tty.js
deleted file mode 100644
index ad312be1f77862..00000000000000
--- a/test/parallel/test-handle-wrap-isrefed-tty.js
+++ /dev/null
@@ -1,33 +0,0 @@
-'use strict';
-
-const common = require('../common');
-const strictEqual = require('assert').strictEqual;
-const spawn = require('child_process').spawn;
-
-function makeAssert(message) {
- return function(actual, expected) {
- strictEqual(actual, expected, message);
- };
-}
-const assert = makeAssert('hasRef() not working on tty_wrap');
-
-if (process.argv[2] === 'child') {
- // Test tty_wrap in piped child to guarentee stdin being a TTY.
- const ReadStream = require('tty').ReadStream;
- const tty = new ReadStream(0);
- assert(Object.getPrototypeOf(tty._handle).hasOwnProperty('hasRef'), true);
- assert(tty._handle.hasRef(), true);
- tty.unref();
- assert(tty._handle.hasRef(), false);
- tty._handle.close(
- common.mustCall(() => assert(tty._handle.hasRef(), false)));
- return;
-}
-
-// Use spawn so that we can be sure that stdin has a _handle property.
-// Refs: https://github.com/nodejs/node/pull/5916
-const proc = spawn(process.execPath, [__filename, 'child'], { stdio: 'pipe' });
-proc.stderr.pipe(process.stderr);
-proc.on('exit', common.mustCall(function(exitCode) {
- process.exitCode = exitCode;
-}));
diff --git a/test/parallel/test-handle-wrap-isrefed.js b/test/parallel/test-handle-wrap-isrefed.js
index b5dbeb23bfd63a..66353fcc0362b3 100644
--- a/test/parallel/test-handle-wrap-isrefed.js
+++ b/test/parallel/test-handle-wrap-isrefed.js
@@ -3,99 +3,128 @@
const common = require('../common');
const strictEqual = require('assert').strictEqual;
-function makeAssert(message) {
- return function(actual, expected) {
- strictEqual(actual, expected, message);
- };
-}
-
-
// child_process
{
- const assert = makeAssert('hasRef() not working on process_wrap');
const spawn = require('child_process').spawn;
const cmd = common.isWindows ? 'rundll32' : 'ls';
const cp = spawn(cmd);
- assert(Object.getPrototypeOf(cp._handle).hasOwnProperty('hasRef'), true);
- assert(cp._handle.hasRef(), true);
+ strictEqual(Object.getPrototypeOf(cp._handle).hasOwnProperty('hasRef'),
+ true, 'process_wrap: hasRef() missing');
+ strictEqual(cp._handle.hasRef(),
+ true, 'process_wrap: not initially refed');
cp.unref();
- assert(cp._handle.hasRef(), false);
+ strictEqual(cp._handle.hasRef(),
+ false, 'process_wrap: unref() ineffective');
cp.ref();
- assert(cp._handle.hasRef(), true);
- cp._handle.close(common.mustCall(() => assert(cp._handle.hasRef(), false)));
+ strictEqual(cp._handle.hasRef(),
+ true, 'process_wrap: ref() ineffective');
+ cp._handle.close(common.mustCall(() =>
+ strictEqual(cp._handle.hasRef(),
+ false, 'process_wrap: not unrefed on close')));
}
-// dgram
+// dgram ipv4
{
- const assert = makeAssert('hasRef() not working on udp_wrap');
const dgram = require('dgram');
-
const sock4 = dgram.createSocket('udp4');
- assert(Object.getPrototypeOf(sock4._handle).hasOwnProperty('hasRef'), true);
- assert(sock4._handle.hasRef(), true);
+ strictEqual(Object.getPrototypeOf(sock4._handle).hasOwnProperty('hasRef'),
+ true, 'udp_wrap: ipv4: hasRef() missing');
+ strictEqual(sock4._handle.hasRef(),
+ true, 'udp_wrap: ipv4: not initially refed');
sock4.unref();
- assert(sock4._handle.hasRef(), false);
+ strictEqual(sock4._handle.hasRef(),
+ false, 'udp_wrap: ipv4: unref() ineffective');
sock4.ref();
- assert(sock4._handle.hasRef(), true);
- sock4._handle.close(
- common.mustCall(() => assert(sock4._handle.hasRef(), false)));
+ strictEqual(sock4._handle.hasRef(),
+ true, 'udp_wrap: ipv4: ref() ineffective');
+ sock4._handle.close(common.mustCall(() =>
+ strictEqual(sock4._handle.hasRef(),
+ false, 'udp_wrap: ipv4: not unrefed on close')));
+}
+
+// dgram ipv6
+{
+ const dgram = require('dgram');
const sock6 = dgram.createSocket('udp6');
- assert(Object.getPrototypeOf(sock6._handle).hasOwnProperty('hasRef'), true);
- assert(sock6._handle.hasRef(), true);
+ strictEqual(Object.getPrototypeOf(sock6._handle).hasOwnProperty('hasRef'),
+ true, 'udp_wrap: ipv6: hasRef() missing');
+ strictEqual(sock6._handle.hasRef(),
+ true, 'udp_wrap: ipv6: not initially refed');
sock6.unref();
- assert(sock6._handle.hasRef(), false);
+ strictEqual(sock6._handle.hasRef(),
+ false, 'udp_wrap: ipv6: unref() ineffective');
sock6.ref();
- assert(sock6._handle.hasRef(), true);
- sock6._handle.close(
- common.mustCall(() => assert(sock6._handle.hasRef(), false)));
+ strictEqual(sock6._handle.hasRef(),
+ true, 'udp_wrap: ipv6: ref() ineffective');
+ sock6._handle.close(common.mustCall(() =>
+ strictEqual(sock6._handle.hasRef(),
+ false, 'udp_wrap: ipv6: not unrefed on close')));
}
// pipe
{
- const assert = makeAssert('hasRef() not working on pipe_wrap');
const Pipe = process.binding('pipe_wrap').Pipe;
const handle = new Pipe();
- assert(Object.getPrototypeOf(handle).hasOwnProperty('hasRef'), true);
- assert(handle.hasRef(), true);
+ strictEqual(Object.getPrototypeOf(handle).hasOwnProperty('hasRef'),
+ true, 'pipe_wrap: hasRef() missing');
+ strictEqual(handle.hasRef(),
+ true, 'pipe_wrap: not initially refed');
handle.unref();
- assert(handle.hasRef(), false);
+ strictEqual(handle.hasRef(),
+ false, 'pipe_wrap: unref() ineffective');
handle.ref();
- assert(handle.hasRef(), true);
- handle.close(common.mustCall(() => assert(handle.hasRef(), false)));
+ strictEqual(handle.hasRef(),
+ true, 'pipe_wrap: ref() ineffective');
+ handle.close(common.mustCall(() =>
+ strictEqual(handle.hasRef(),
+ false, 'pipe_wrap: not unrefed on close')));
}
// tcp
{
- const assert = makeAssert('hasRef() not working on tcp_wrap');
const net = require('net');
const server = net.createServer(() => {}).listen(0);
- assert(Object.getPrototypeOf(server._handle).hasOwnProperty('hasRef'), true);
- assert(server._handle.hasRef(), true);
- assert(server._unref, false);
+ strictEqual(Object.getPrototypeOf(server._handle).hasOwnProperty('hasRef'),
+ true, 'tcp_wrap: hasRef() missing');
+ strictEqual(server._handle.hasRef(),
+ true, 'tcp_wrap: not initially refed');
+ strictEqual(server._unref,
+ false, 'tcp_wrap: _unref initially incorrect');
server.unref();
- assert(server._handle.hasRef(), false);
- assert(server._unref, true);
+ strictEqual(server._handle.hasRef(),
+ false, 'tcp_wrap: unref() ineffective');
+ strictEqual(server._unref,
+ true, 'tcp_wrap: _unref not updated on unref()');
server.ref();
- assert(server._handle.hasRef(), true);
- assert(server._unref, false);
- server._handle.close(
- common.mustCall(() => assert(server._handle.hasRef(), false)));
+ strictEqual(server._handle.hasRef(),
+ true, 'tcp_wrap: ref() ineffective');
+ strictEqual(server._unref,
+ false, 'tcp_wrap: _unref not updated on ref()');
+ server._handle.close(common.mustCall(() =>
+ strictEqual(server._handle.hasRef(),
+ false, 'tcp_wrap: not unrefed on close')));
}
// timers
{
- const assert = makeAssert('hasRef() not working on timer_wrap');
const timer = setTimeout(() => {}, 500);
timer.unref();
- assert(Object.getPrototypeOf(timer._handle).hasOwnProperty('hasRef'), true);
- assert(timer._handle.hasRef(), false);
+ strictEqual(Object.getPrototypeOf(timer._handle).hasOwnProperty('hasRef'),
+ true, 'timer_wrap: hasRef() missing');
+ strictEqual(timer._handle.hasRef(),
+ false, 'timer_wrap: unref() ineffective');
timer.ref();
- assert(timer._handle.hasRef(), true);
- timer._handle.close(
- common.mustCall(() => assert(timer._handle.hasRef(), false)));
+ strictEqual(timer._handle.hasRef(),
+ true, 'timer_wrap: ref() ineffective');
+ timer._handle.close(common.mustCall(() =>
+ strictEqual(timer._handle.hasRef(),
+ false, 'timer_wrap: not unrefed on close')));
}
+
+
+// see also test/pseudo-tty/test-handle-wrap-isrefed-tty.js
diff --git a/test/parallel/test-http-parser-bad-ref.js b/test/parallel/test-http-parser-bad-ref.js
index 97b4685e18382b..c4ab1db8659ef7 100644
--- a/test/parallel/test-http-parser-bad-ref.js
+++ b/test/parallel/test-http-parser-bad-ref.js
@@ -75,12 +75,10 @@ demoBug('POST /1', '/22 HTTP/1.1\r\n' +
'Content-Length: 4\r\n\r\n' +
'pong');
-/* eslint-disable align-function-arguments */
demoBug('POST /1/22 HTTP/1.1\r\n' +
'Content-Type: tex', 't/plain\r\n' +
'Content-Length: 4\r\n\r\n' +
'pong');
-/* eslint-enable align-function-arguments */
process.on('exit', function() {
assert.strictEqual(2, headersComplete);
diff --git a/test/parallel/test-https-agent-create-connection.js b/test/parallel/test-https-agent-create-connection.js
new file mode 100644
index 00000000000000..6bd86fe166d3f2
--- /dev/null
+++ b/test/parallel/test-https-agent-create-connection.js
@@ -0,0 +1,146 @@
+'use strict';
+
+const common = require('../common');
+if (!common.hasCrypto) {
+ common.skip('missing crypto');
+ return;
+}
+
+const assert = require('assert');
+const https = require('https');
+
+const agent = new https.Agent();
+
+const fs = require('fs');
+
+const options = {
+ key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
+ cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),
+};
+
+const expectedHeader = /^HTTP\/1.1 200 OK/;
+const expectedBody = /hello world\n/;
+const expectCertError = /^Error: unable to verify the first certificate$/;
+
+const checkRequest = (socket, server) => {
+ let result = '';
+ socket.on('connect', common.mustCall((data) => {
+ socket.write('GET / HTTP/1.1\r\n\r\n');
+ socket.end();
+ }));
+ socket.on('data', common.mustCall((chunk) => {
+ result += chunk;
+ }));
+ socket.on('end', common.mustCall(() => {
+ assert(expectedHeader.test(result));
+ assert(expectedBody.test(result));
+ server.close();
+ }));
+};
+
+function createServer() {
+ return https.createServer(options, (req, res) => {
+ res.end('hello world\n');
+ });
+}
+
+// use option connect
+{
+ const server = createServer();
+ server.listen(0, common.mustCall(() => {
+ const port = server.address().port;
+ const host = 'localhost';
+ const options = {
+ port: port,
+ host: host,
+ rejectUnauthorized: false,
+ _agentKey: agent.getName({
+ port: port,
+ host: host,
+ }),
+ };
+
+ const socket = agent.createConnection(options);
+ checkRequest(socket, server);
+ }));
+}
+
+// use port and option connect
+{
+ const server = createServer();
+ server.listen(0, common.mustCall(() => {
+ const port = server.address().port;
+ const host = 'localhost';
+ const options = {
+ rejectUnauthorized: false,
+ _agentKey: agent.getName({
+ port: port,
+ host: host,
+ }),
+ };
+ const socket = agent.createConnection(port, options);
+ checkRequest(socket, server);
+ }));
+}
+
+// use port and host and option connect
+{
+ const server = createServer();
+ server.listen(0, common.mustCall(() => {
+ const port = server.address().port;
+ const host = 'localhost';
+ const options = {
+ rejectUnauthorized: false,
+ _agentKey: agent.getName({
+ port: port,
+ host: host,
+ }),
+ };
+ const socket = agent.createConnection(port, host, options);
+ checkRequest(socket, server);
+ }));
+}
+
+// use port and host and option does not have agentKey
+{
+ const server = createServer();
+ server.listen(0, common.mustCall(() => {
+ const port = server.address().port;
+ const host = 'localhost';
+ const options = {
+ rejectUnauthorized: false,
+ };
+ const socket = agent.createConnection(port, host, options);
+ checkRequest(socket, server);
+ }));
+}
+
+// options is null
+{
+ const server = createServer();
+ server.listen(0, common.mustCall(() => {
+ const port = server.address().port;
+ const host = 'localhost';
+ const options = null;
+ const socket = agent.createConnection(port, host, options);
+ socket.on('error', common.mustCall((e) => {
+ assert(expectCertError.test(e.toString()));
+ server.close();
+ }));
+ }));
+}
+
+// options is undefined
+{
+ const server = createServer();
+ server.listen(0, common.mustCall(() => {
+ const port = server.address().port;
+ const host = 'localhost';
+ const options = undefined;
+ const socket = agent.createConnection(port, host, options);
+ socket.on('error', common.mustCall((e) => {
+ assert(expectCertError.test(e.toString()));
+ server.close();
+ }));
+ }));
+}
diff --git a/test/parallel/test-icu-punycode.js b/test/parallel/test-icu-punycode.js
index 62508bc9f78f49..411704bb8f4477 100644
--- a/test/parallel/test-icu-punycode.js
+++ b/test/parallel/test-icu-punycode.js
@@ -6,67 +6,36 @@ if (!common.hasIntl) {
return;
}
-const icu = getPunycode();
+const icu = process.binding('icu');
const assert = require('assert');
-function getPunycode() {
- try {
- return process.binding('icu');
- } catch (err) {
- return undefined;
+const tests = require('../fixtures/url-idna.js');
+
+{
+ for (const [i, { ascii, unicode }] of tests.valid.entries()) {
+ assert.strictEqual(ascii, icu.toASCII(unicode), `toASCII(${i + 1})`);
+ assert.strictEqual(unicode, icu.toUnicode(ascii), `toUnicode(${i + 1})`);
+ assert.strictEqual(ascii, icu.toASCII(icu.toUnicode(ascii)),
+ `toASCII(toUnicode(${i + 1}))`);
+ assert.strictEqual(unicode, icu.toUnicode(icu.toASCII(unicode)),
+ `toUnicode(toASCII(${i + 1}))`);
}
}
-// Credit for list: http://www.i18nguy.com/markup/idna-examples.html
-const tests = [
- 'افغانستا.icom.museum',
- 'الجزائر.icom.museum',
- 'österreich.icom.museum',
- 'বাংলাদেশ.icom.museum',
- 'беларусь.icom.museum',
- 'belgië.icom.museum',
- 'българия.icom.museum',
- 'تشادر.icom.museum',
- '中国.icom.museum',
- 'القمر.icom.museum',
- 'κυπρος.icom.museum',
- 'českárepublika.icom.museum',
- 'مصر.icom.museum',
- 'ελλάδα.icom.museum',
- 'magyarország.icom.museum',
- 'ísland.icom.museum',
- 'भारत.icom.museum',
- 'ايران.icom.museum',
- 'éire.icom.museum',
- 'איקו״ם.ישראל.museum',
- '日本.icom.museum',
- 'الأردن.icom.museum',
- 'қазақстан.icom.museum',
- '한국.icom.museum',
- 'кыргызстан.icom.museum',
- 'ລາວ.icom.museum',
- 'لبنان.icom.museum',
- 'македонија.icom.museum',
- 'موريتانيا.icom.museum',
- 'méxico.icom.museum',
- 'монголулс.icom.museum',
- 'المغرب.icom.museum',
- 'नेपाल.icom.museum',
- 'عمان.icom.museum',
- 'قطر.icom.museum',
- 'românia.icom.museum',
- 'россия.иком.museum',
- 'србијаицрнагора.иком.museum',
- 'இலங்கை.icom.museum',
- 'españa.icom.museum',
- 'ไทย.icom.museum',
- 'تونس.icom.museum',
- 'türkiye.icom.museum',
- 'украина.icom.museum',
- 'việtnam.icom.museum'
-];
+{
+ const errorRe = {
+ ascii: /^Error: Cannot convert name to ASCII$/,
+ unicode: /^Error: Cannot convert name to Unicode$/
+ };
+ const convertFunc = {
+ ascii: icu.toASCII,
+ unicode: icu.toUnicode
+ };
-// Testing the roundtrip
-tests.forEach((i) => {
- assert.strictEqual(i, icu.toUnicode(icu.toASCII(i)));
-});
+ for (const [i, { url, mode }] of tests.invalid.entries()) {
+ assert.throws(() => convertFunc[mode](url), errorRe[mode],
+ `Invalid case ${i + 1}`);
+ assert.doesNotThrow(() => convertFunc[mode](url, true),
+ `Invalid case ${i + 1} in lenient mode`);
+ }
+}
diff --git a/test/parallel/test-internal-util-assertCrypto.js b/test/parallel/test-internal-util-assertCrypto.js
index f3003a2fee04e9..3a7acdb65c6b89 100644
--- a/test/parallel/test-internal-util-assertCrypto.js
+++ b/test/parallel/test-internal-util-assertCrypto.js
@@ -6,7 +6,7 @@ const util = require('internal/util');
if (!process.versions.openssl) {
assert.throws(() => util.assertCrypto(),
- /^Node.js is not compiled with openssl crypto support$/);
+ /^Error: Node.js is not compiled with openssl crypto support$/);
} else {
assert.doesNotThrow(() => util.assertCrypto());
}
diff --git a/test/parallel/test-process-no-deprecation.js b/test/parallel/test-process-no-deprecation.js
index 60394ea0d38ddf..4d4dfa86fb67ad 100644
--- a/test/parallel/test-process-no-deprecation.js
+++ b/test/parallel/test-process-no-deprecation.js
@@ -1,7 +1,7 @@
'use strict';
// Flags: --no-warnings
-// The --no-warnings flag only supresses writing the warning to stderr, not the
+// The --no-warnings flag only suppresses writing the warning to stderr, not the
// emission of the corresponding event. This test file can be run without it.
const common = require('../common');
diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js
index 70aac915f6b594..3cf1b52e6179f2 100644
--- a/test/parallel/test-repl.js
+++ b/test/parallel/test-repl.js
@@ -1,4 +1,5 @@
-/* eslint-disable max-len, strict */
+'use strict';
+
const common = require('../common');
const assert = require('assert');
@@ -166,18 +167,32 @@ function error_test() {
{ client: client_unix, send: 'new RegExp("foo", "wrong modifier");',
expect: /\bSyntaxError: Invalid flags supplied to RegExp constructor/ },
// strict mode syntax errors should be caught (GH-5178)
- { client: client_unix, send: '(function() { "use strict"; return 0755; })()',
+ { client: client_unix,
+ send: '(function() { "use strict"; return 0755; })()',
expect: /\bSyntaxError: Octal literals are not allowed in strict mode/ },
- { client: client_unix, send: '(function(a, a, b) { "use strict"; return a + b + c; })()',
- expect: /\bSyntaxError: Duplicate parameter name not allowed in this context/ },
- { client: client_unix, send: '(function() { "use strict"; with (this) {} })()',
- expect: /\bSyntaxError: Strict mode code may not include a with statement/ },
- { client: client_unix, send: '(function() { "use strict"; var x; delete x; })()',
- expect: /\bSyntaxError: Delete of an unqualified identifier in strict mode/ },
- { client: client_unix, send: '(function() { "use strict"; eval = 17; })()',
+ {
+ client: client_unix,
+ send: '(function(a, a, b) { "use strict"; return a + b + c; })()',
+ expect: /\bSyntaxError: Duplicate parameter name not allowed in this context/ // eslint-disable-line max-len
+ },
+ {
+ client: client_unix,
+ send: '(function() { "use strict"; with (this) {} })()',
+ expect: /\bSyntaxError: Strict mode code may not include a with statement/
+ },
+ {
+ client: client_unix,
+ send: '(function() { "use strict"; var x; delete x; })()',
+ expect: /\bSyntaxError: Delete of an unqualified identifier in strict mode/ // eslint-disable-line max-len
+ },
+ { client: client_unix,
+ send: '(function() { "use strict"; eval = 17; })()',
expect: /\bSyntaxError: Unexpected eval or arguments in strict mode/ },
- { client: client_unix, send: '(function() { "use strict"; if (true) function f() { } })()',
- expect: /\bSyntaxError: In strict mode code, functions can only be declared at top level or inside a block./ },
+ {
+ client: client_unix,
+ send: '(function() { "use strict"; if (true) function f() { } })()',
+ expect: /\bSyntaxError: In strict mode code, functions can only be declared at top level or inside a block./ // eslint-disable-line max-len
+ },
// Named functions can be used:
{ client: client_unix, send: 'function blah() { return 1; }',
expect: prompt_unix },
@@ -310,16 +325,20 @@ function error_test() {
{ client: client_unix, send: 'require("internal/repl")',
expect: /^Error: Cannot find module 'internal\/repl'/ },
// REPL should handle quotes within regexp literal in multiline mode
- { client: client_unix, send: "function x(s) {\nreturn s.replace(/'/,'');\n}",
+ { client: client_unix,
+ send: "function x(s) {\nreturn s.replace(/'/,'');\n}",
expect: prompt_multiline + prompt_multiline +
'undefined\n' + prompt_unix },
- { client: client_unix, send: "function x(s) {\nreturn s.replace(/'/,'');\n}",
+ { client: client_unix,
+ send: "function x(s) {\nreturn s.replace(/'/,'');\n}",
expect: prompt_multiline + prompt_multiline +
'undefined\n' + prompt_unix },
- { client: client_unix, send: 'function x(s) {\nreturn s.replace(/"/,"");\n}',
+ { client: client_unix,
+ send: 'function x(s) {\nreturn s.replace(/"/,"");\n}',
expect: prompt_multiline + prompt_multiline +
'undefined\n' + prompt_unix },
- { client: client_unix, send: 'function x(s) {\nreturn s.replace(/.*/,"");\n}',
+ { client: client_unix,
+ send: 'function x(s) {\nreturn s.replace(/.*/,"");\n}',
expect: prompt_multiline + prompt_multiline +
'undefined\n' + prompt_unix },
{ client: client_unix, send: '{ var x = 4; }',
@@ -354,14 +373,20 @@ function error_test() {
expect: '{ value: undefined, done: true }' },
// https://github.com/nodejs/node/issues/9300
- { client: client_unix, send: 'function foo() {\nvar bar = 1 / 1; // "/"\n}',
- expect: prompt_multiline + prompt_multiline + 'undefined\n' + prompt_unix },
-
- { client: client_unix, send: '(function() {\nreturn /foo/ / /bar/;\n}())',
- expect: prompt_multiline + prompt_multiline + 'NaN\n' + prompt_unix },
-
- { client: client_unix, send: '(function() {\nif (false) {} /bar"/;\n}())',
- expect: prompt_multiline + prompt_multiline + 'undefined\n' + prompt_unix }
+ {
+ client: client_unix, send: 'function foo() {\nvar bar = 1 / 1; // "/"\n}',
+ expect: `${prompt_multiline}${prompt_multiline}undefined\n${prompt_unix}`
+ },
+
+ {
+ client: client_unix, send: '(function() {\nreturn /foo/ / /bar/;\n}())',
+ expect: prompt_multiline + prompt_multiline + 'NaN\n' + prompt_unix
+ },
+
+ {
+ client: client_unix, send: '(function() {\nif (false) {} /bar"/;\n}())',
+ expect: prompt_multiline + prompt_multiline + 'undefined\n' + prompt_unix
+ }
]);
}
diff --git a/test/parallel/test-setproctitle.js b/test/parallel/test-setproctitle.js
index a971d604b37d14..072ddd447e5bf9 100644
--- a/test/parallel/test-setproctitle.js
+++ b/test/parallel/test-setproctitle.js
@@ -4,8 +4,7 @@ const common = require('../common');
// FIXME add sunos support
if (common.isSunOS) {
- console.log(`1..0 # Skipped: Unsupported platform [${process.platform}]`);
- return;
+ return common.skip(`Unsupported platform [${process.platform}]`);
}
const assert = require('assert');
@@ -22,8 +21,9 @@ process.title = title;
assert.strictEqual(process.title, title);
// Test setting the title but do not try to run `ps` on Windows.
-if (common.isWindows)
- return;
+if (common.isWindows) {
+ return common.skip('Windows does not have "ps" utility');
+}
exec(`ps -p ${process.pid} -o args=`, function callback(error, stdout, stderr) {
assert.ifError(error);
diff --git a/test/parallel/test-stream-readable-needReadable.js b/test/parallel/test-stream-readable-needReadable.js
index 48229edd202333..be397dc5dc5f74 100644
--- a/test/parallel/test-stream-readable-needReadable.js
+++ b/test/parallel/test-stream-readable-needReadable.js
@@ -74,7 +74,7 @@ const slowProducer = new Readable({
slowProducer.on('readable', common.mustCall(() => {
if (slowProducer.read(8) === null) {
- // The buffer doesn't have enough data, and the stream is not ened,
+ // The buffer doesn't have enough data, and the stream is not need,
// we need to notify the reader when data arrives.
assert.strictEqual(slowProducer._readableState.needReadable, true);
} else {
diff --git a/test/parallel/test-timers-socket-timeout-removes-other-socket-unref-timer.js b/test/parallel/test-timers-socket-timeout-removes-other-socket-unref-timer.js
index f42144360b6941..5d57bbaae0011e 100644
--- a/test/parallel/test-timers-socket-timeout-removes-other-socket-unref-timer.js
+++ b/test/parallel/test-timers-socket-timeout-removes-other-socket-unref-timer.js
@@ -25,7 +25,7 @@ const server = net.createServer(function onClient(client) {
clients[1].end();
});
- // Use a delay that is higher than the lowest timer resolution accross all
+ // Use a delay that is higher than the lowest timer resolution across all
// supported platforms, so that the two timers don't fire at the same time.
clients[1].setTimeout(50);
}
diff --git a/test/parallel/test-tls-alpn-server-client.js b/test/parallel/test-tls-alpn-server-client.js
index ca5785b09ac05a..9199d946791084 100644
--- a/test/parallel/test-tls-alpn-server-client.js
+++ b/test/parallel/test-tls-alpn-server-client.js
@@ -6,10 +6,10 @@ if (!common.hasCrypto) {
return;
}
-if (!process.features.tls_alpn) {
- console.error('Skipping because node compiled without OpenSSL or ' +
- 'with old OpenSSL version.');
- process.exit(0);
+if (!process.features.tls_alpn || !process.features.tls_npn) {
+ common.skip('Skipping because node compiled without NPN or ALPN' +
+ ' feature of OpenSSL.');
+ return;
}
const assert = require('assert');
diff --git a/test/parallel/test-tls-check-server-identity.js b/test/parallel/test-tls-check-server-identity.js
index 5c89ef8bf4d425..9439735ce069b4 100644
--- a/test/parallel/test-tls-check-server-identity.js
+++ b/test/parallel/test-tls-check-server-identity.js
@@ -177,7 +177,7 @@ const tests = [
error: 'Host: a.b.a.com. is not in the cert\'s altnames: ' +
'DNS:*b.a.com'
},
- // Mutliple DNS names
+ // Multiple DNS names
{
host: 'a.b.a.com', cert: {
subjectaltname: 'DNS:*b.a.com, DNS:a.b.a.com',
diff --git a/test/parallel/test-tls-empty-sni-context.js b/test/parallel/test-tls-empty-sni-context.js
index 994a81e9ea9e6d..e68378fb4eac50 100644
--- a/test/parallel/test-tls-empty-sni-context.js
+++ b/test/parallel/test-tls-empty-sni-context.js
@@ -3,16 +3,14 @@
const common = require('../common');
if (!process.features.tls_sni) {
- console.log('1..0 # Skipped: node compiled without OpenSSL or ' +
- 'with old OpenSSL version.');
+ common.skip('node compiled without OpenSSL or with old OpenSSL version.');
return;
}
const assert = require('assert');
if (!common.hasCrypto) {
- console.log('1..0 # Skipped: missing crypto');
- return;
+ return common.skip('missing crypto');
}
const tls = require('tls');
diff --git a/test/parallel/test-tls-npn-server-client.js b/test/parallel/test-tls-npn-server-client.js
index 3c69204d680d7c..c12fddb55bfab0 100644
--- a/test/parallel/test-tls-npn-server-client.js
+++ b/test/parallel/test-tls-npn-server-client.js
@@ -1,8 +1,8 @@
'use strict';
const common = require('../common');
if (!process.features.tls_npn) {
- common.skip('node compiled without OpenSSL or ' +
- 'with old OpenSSL version.');
+ common.skip('Skipping because node compiled without NPN feature of' +
+ ' OpenSSL.');
return;
}
diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js
index cf07f4c8213cee..33e0253a9e9b7c 100644
--- a/test/parallel/test-util-inspect.js
+++ b/test/parallel/test-util-inspect.js
@@ -50,6 +50,9 @@ assert.strictEqual(util.inspect(Object.create({},
{visible: {value: 1, enumerable: true}, hidden: {value: 2}})),
'{ visible: 1 }'
);
+assert.strictEqual(util.inspect(Object.assign(new String('hello'),
+ { [Symbol('foo')]: 123 }), { showHidden: true }),
+ '{ [String: \'hello\'] [length]: 5, [Symbol(foo)]: 123 }');
{
const regexp = /regexp/;
diff --git a/test/parallel/test-vm-timeout.js b/test/parallel/test-vm-timeout.js
index 5260ca7dc28572..6ed73f8b4ffd78 100644
--- a/test/parallel/test-vm-timeout.js
+++ b/test/parallel/test-vm-timeout.js
@@ -6,7 +6,7 @@ const vm = require('vm');
// Test 1: Timeout of 100ms executing endless loop
assert.throws(function() {
vm.runInThisContext('while(true) {}', { timeout: 100 });
-});
+}, /^Error: Script execution timed out\.$/);
// Test 2: Timeout must be >= 0ms
assert.throws(function() {
diff --git a/test/parallel/test-whatwg-url-domainto.js b/test/parallel/test-whatwg-url-domainto.js
new file mode 100644
index 00000000000000..f891f95a19cd3b
--- /dev/null
+++ b/test/parallel/test-whatwg-url-domainto.js
@@ -0,0 +1,36 @@
+'use strict';
+const common = require('../common');
+
+if (!common.hasIntl) {
+ common.skip('missing Intl');
+ return;
+}
+
+const assert = require('assert');
+const { domainToASCII, domainToUnicode } = require('url');
+
+// Tests below are not from WPT.
+const tests = require('../fixtures/url-idna.js');
+
+{
+ for (const [i, { ascii, unicode }] of tests.valid.entries()) {
+ assert.strictEqual(ascii, domainToASCII(unicode),
+ `domainToASCII(${i + 1})`);
+ assert.strictEqual(unicode, domainToUnicode(ascii),
+ `domainToUnicode(${i + 1})`);
+ assert.strictEqual(ascii, domainToASCII(domainToUnicode(ascii)),
+ `domainToASCII(domainToUnicode(${i + 1}))`);
+ assert.strictEqual(unicode, domainToUnicode(domainToASCII(unicode)),
+ `domainToUnicode(domainToASCII(${i + 1}))`);
+ }
+}
+
+{
+ const convertFunc = {
+ ascii: domainToASCII,
+ unicode: domainToUnicode
+ };
+
+ for (const [i, { url, mode }] of tests.invalid.entries())
+ assert.strictEqual(convertFunc[mode](url), '', `Invalid case ${i + 1}`);
+}
diff --git a/test/pseudo-tty/ref_keeps_node_running.js b/test/pseudo-tty/ref_keeps_node_running.js
new file mode 100644
index 00000000000000..de3c6531ef6924
--- /dev/null
+++ b/test/pseudo-tty/ref_keeps_node_running.js
@@ -0,0 +1,27 @@
+'use strict';
+require('../common');
+
+const { TTY, isTTY } = process.binding('tty_wrap');
+const strictEqual = require('assert').strictEqual;
+
+strictEqual(isTTY(0), true, 'fd 0 is not a TTY');
+
+const handle = new TTY(0);
+handle.readStart();
+handle.onread = () => {};
+
+function isHandleActive(handle) {
+ return process._getActiveHandles().some((active) => active === handle);
+}
+
+strictEqual(isHandleActive(handle), true, 'TTY handle not initially active');
+
+handle.unref();
+
+strictEqual(isHandleActive(handle), false, 'TTY handle active after unref()');
+
+handle.ref();
+
+strictEqual(isHandleActive(handle), true, 'TTY handle inactive after ref()');
+
+handle.unref();
diff --git a/test/pseudo-tty/ref_keeps_node_running.out b/test/pseudo-tty/ref_keeps_node_running.out
new file mode 100644
index 00000000000000..e69de29bb2d1d6
diff --git a/test/pseudo-tty/test-handle-wrap-isrefed-tty.js b/test/pseudo-tty/test-handle-wrap-isrefed-tty.js
new file mode 100644
index 00000000000000..4baf6200962cc3
--- /dev/null
+++ b/test/pseudo-tty/test-handle-wrap-isrefed-tty.js
@@ -0,0 +1,23 @@
+'use strict';
+
+// see also test/parallel/test-handle-wrap-isrefed.js
+
+const common = require('../common');
+const strictEqual = require('assert').strictEqual;
+const ReadStream = require('tty').ReadStream;
+const tty = new ReadStream(0);
+const isTTY = process.binding('tty_wrap').isTTY;
+strictEqual(isTTY(0), true, 'tty_wrap: stdin is not a TTY');
+strictEqual(Object.getPrototypeOf(tty._handle).hasOwnProperty('hasRef'),
+ true, 'tty_wrap: hasRef() missing');
+strictEqual(tty._handle.hasRef(),
+ true, 'tty_wrap: not initially refed');
+tty.unref();
+strictEqual(tty._handle.hasRef(),
+ false, 'tty_wrap: unref() ineffective');
+tty.ref();
+strictEqual(tty._handle.hasRef(),
+ true, 'tty_wrap: ref() ineffective');
+tty._handle.close(common.mustCall(() =>
+ strictEqual(tty._handle.hasRef(),
+ false, 'tty_wrap: not unrefed on close')));
diff --git a/test/pseudo-tty/test-handle-wrap-isrefed-tty.out b/test/pseudo-tty/test-handle-wrap-isrefed-tty.out
new file mode 100644
index 00000000000000..e69de29bb2d1d6
diff --git a/tools/test.py b/tools/test.py
index f46b13fa30a66a..d6715937b60da3 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -702,8 +702,13 @@ def Execute(args, context, timeout=None, env={}, faketty=False):
fd_in = 0
pty_out = None
- # Extend environment
env_copy = os.environ.copy()
+
+ # Remove NODE_PATH
+ if "NODE_PATH" in env_copy:
+ del env_copy["NODE_PATH"]
+
+ # Extend environment
for key, value in env.iteritems():
env_copy[key] = value