diff --git a/CHANGELOG.md b/CHANGELOG.md index 656e193ec50399..88fcfff7452bcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,8 @@ release. -8.8.0
+8.8.1
+8.8.0
8.7.0
8.6.0
8.5.0
diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index e96585f4fdbb75..acbd3fa9b5d8c0 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -24,8 +24,9 @@ understand the project governance model as outlined in ## Issues and Pull Requests -Courtesy should always be shown to individuals submitting issues and -pull requests to the Node.js project. +Courtesy should **always** be shown to individuals submitting issues and pull +requests to the Node.js project. Be welcoming to first time contributors, +identified by the GitHub ![badge](./doc/first_timer_badge.png) badge. Collaborators should feel free to take full responsibility for managing issues and pull requests they feel qualified to handle, as @@ -68,6 +69,9 @@ wide-reaching impact), and focused changes that affect only documentation and/or the test suite, may be landed after a shorter delay if they have multiple approvals. +For first time contributors, ask the author if they have configured their git +username and email to their liking as per [this guide][git-username]. + For non-breaking changes, if there is no disagreement amongst Collaborators, a pull request may be landed given appropriate review. Where there is discussion amongst Collaborators, consensus should be @@ -362,10 +366,8 @@ The TSC should serve as the final arbiter where required. * If you do, please force-push removing the merge. * Reasons for not using the web interface button: * The merge method will add an unnecessary merge commit. - * The rebase & merge method adds metadata to the commit title. - * The rebase method changes the author. * The squash & merge method has been known to add metadata to the - commit title. + commit title (the PR #). * If more than one author has contributed to the PR, keep the most recent author when squashing. @@ -675,3 +677,4 @@ LTS working group and the Release team. [backporting guide]: doc/guides/backporting-to-release-lines.md [Stability Index]: doc/api/documentation.md#stability-index [Enhancement Proposal]: https://github.com/nodejs/node-eps +[git-username]: https://help.github.com/articles/setting-your-username-in-git/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2f63dd29d79346..1c6de8d25498fe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -854,11 +854,8 @@ By making a contribution to this project, I certify that: [Building guide]: ./BUILDING.md [CI (Continuous Integration) test run]: #ci-testing [Code of Conduct]: https://github.com/nodejs/TSC/blob/master/CODE_OF_CONDUCT.md -[guide for writing tests in Node.js]: ./doc/guides/writing-tests.md [https://ci.nodejs.org/]: https://ci.nodejs.org/ [IRC in the #node-dev channel]: https://webchat.freenode.net?channels=node-dev&uio=d4 [Node.js help repository]: https://github.com/nodejs/help/issues -[notes about the waiting time]: #waiting-until-the-pull-request-gets-landed [Onboarding guide]: ./doc/onboarding.md -[on GitHub]: https://github.com/nodejs/node [Technical Steering Committee (TSC) repository]: https://github.com/nodejs/TSC/issues diff --git a/doc/api/assert.md b/doc/api/assert.md index c3ad6c42492c97..ca110ecbfc44dc 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -628,7 +628,6 @@ assert(Object.is(str1 / 1, str2 / 1)); For more information, see [MDN's guide on equality comparisons and sameness][mdn-equality-guide]. -[`Error`]: errors.html#errors_class_error [`Error.captureStackTrace`]: errors.html#errors_error_capturestacktrace_targetobject_constructoropt [`Map`]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Map [`Object.is()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 5f94d750c5814c..86f2ae7cc1ee70 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -457,7 +457,7 @@ new Promise((resolve) => resolve(true)).then((a) => {}); calls the following callbacks: -``` +```text init for PROMISE with id 5, trigger id: 1 promise resolve 5 # corresponds to resolve(true) init for PROMISE with id 6, trigger id: 5 # the Promise returned by then() diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 37460c80fd6fd8..547a42aef56075 100755 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -1372,7 +1372,6 @@ unavailable. [`Error`]: errors.html#errors_class_error [`EventEmitter`]: events.html#events_class_eventemitter [`JSON.stringify` spec]: https://tc39.github.io/ecma262/#sec-json.stringify -[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify [`subprocess.connected`]: #child_process_subprocess_connected [`subprocess.disconnect()`]: #child_process_subprocess_disconnect [`subprocess.kill()`]: #child_process_subprocess_kill_signal diff --git a/doc/api/dns.md b/doc/api/dns.md index d564aea424d4d6..56f2d0660ca5c7 100644 --- a/doc/api/dns.md +++ b/doc/api/dns.md @@ -671,4 +671,3 @@ uses. For instance, _they do not use the configuration from `/etc/hosts`_. [Implementation considerations section]: #dns_implementation_considerations [rfc5952]: https://tools.ietf.org/html/rfc5952#section-6 [supported `getaddrinfo` flags]: #dns_supported_getaddrinfo_flags -[the official libuv documentation]: http://docs.libuv.org/en/latest/threadpool.html diff --git a/doc/api/esm.md b/doc/api/esm.md index bc25c88b9a82e9..d8143da378f768 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -43,7 +43,6 @@ points into ESM graphs at run time. | `require('./foo.mjs')` | ES Modules have differing resolution and timing, use language standard `import()` | | `import()` | pending newer V8 release used in Node.js | | `import.meta` | pending V8 implementation | -| Loader Hooks | pending Node.js EP creation/consensus | ## Notable differences between `import` and `require` @@ -175,7 +174,7 @@ export function resolve(specifier, parentModuleURL/*, defaultResolve */) { With this loader, running: -``` +```console NODE_OPTIONS='--experimental-modules --loader ./custom-loader.mjs' node x.js ``` diff --git a/doc/api/http.md b/doc/api/http.md index 3219893761c467..c0797d5d7d632d 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -1937,7 +1937,6 @@ const req = http.request(options, (res) => { ``` [`'checkContinue'`]: #http_event_checkcontinue -[`'listening'`]: net.html#net_event_listening [`'request'`]: #http_event_request [`'response'`]: #http_event_response [`Agent`]: #http_class_http_agent @@ -1956,9 +1955,6 @@ const req = http.request(options, (res) => { [`http.request()`]: #http_http_request_options_callback [`message.headers`]: #http_message_headers [`net.Server.close()`]: net.html#net_server_close_callback -[`net.Server.listen()`]: net.html#net_server_listen_handle_backlog_callback -[`net.Server.listen(path)`]: net.html#net_server_listen_path_backlog_callback -[`net.Server.listen(port)`]: net.html#net_server_listen_port_host_backlog_callback [`net.Server`]: net.html#net_class_net_server [`net.Socket`]: net.html#net_class_net_socket [`net.createConnection()`]: net.html#net_net_createconnection_options_connectlistener @@ -1984,5 +1980,3 @@ const req = http.request(options, (res) => { [Readable Stream]: stream.html#stream_class_stream_readable [Writable Stream]: stream.html#stream_class_stream_writable [socket.unref()]: net.html#net_socket_unref -[unspecified IPv4 address]: https://en.wikipedia.org/wiki/0.0.0.0 -[unspecified IPv6 address]: https://en.wikipedia.org/wiki/IPv6_address#Unspecified_address diff --git a/doc/api/https.md b/doc/api/https.md index 3ff97bf446b667..8b7fc2f3d648d0 100644 --- a/doc/api/https.md +++ b/doc/api/https.md @@ -268,7 +268,6 @@ const req = https.request(options, (res) => { [`http.Server`]: http.html#http_class_http_server [`http.close()`]: http.html#http_server_close_callback [`http.get()`]: http.html#http_http_get_options_callback -[`http.listen()`]: http.html#http_server_listen_port_hostname_backlog_callback [`http.request()`]: http.html#http_http_request_options_callback [`https.Agent`]: #https_class_https_agent [`https.request()`]: #https_https_request_options_callback diff --git a/doc/api/os.md b/doc/api/os.md index be61837bae058f..2efdf0117e21f9 100644 --- a/doc/api/os.md +++ b/doc/api/os.md @@ -1186,5 +1186,4 @@ The following error codes are specific to the Windows operating system: [`process.arch`]: process.html#process_process_arch [`process.platform`]: process.html#process_process_platform -[OS Constants]: #os_os_constants [uname(3)]: https://linux.die.net/man/3/uname diff --git a/doc/api/process.md b/doc/api/process.md index 40a596523967c9..897143e2e32446 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -1838,7 +1838,6 @@ cases: [`Error`]: errors.html#errors_class_error [`EventEmitter`]: events.html#events_class_eventemitter [`JSON.stringify` spec]: https://tc39.github.io/ecma262/#sec-json.stringify -[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify [`console.error()`]: console.html#console_console_error_data_args [`console.log()`]: console.html#console_console_log_data_args [`end()`]: stream.html#stream_writable_end_chunk_encoding_callback diff --git a/doc/api/stream.md b/doc/api/stream.md index d2af5cd93370bf..96f67d75b36772 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -2224,7 +2224,6 @@ contain multi-byte characters. [http-incoming-message]: http.html#http_class_http_incomingmessage [zlib]: zlib.html [hwm-gotcha]: #stream_highwatermark_discrepency_after_calling_readable_setencoding -[Readable]: #stream_class_stream_readable [stream-_flush]: #stream_transform_flush_callback [stream-_read]: #stream_readable_read_size_1 [stream-_transform]: #stream_transform_transform_chunk_encoding_callback diff --git a/doc/api/zlib.md b/doc/api/zlib.md index 85a3743a9a3b8c..9b7b30aa7deaf4 100644 --- a/doc/api/zlib.md +++ b/doc/api/zlib.md @@ -462,7 +462,7 @@ Creates and returns a new [DeflateRaw][] object with the given [options][]. is set to 8 for raw deflate streams. zlib does not have a working implementation of an 8-bit Window for raw deflate streams and would automatically set windowBit to 9 if initially set to 8. Newer versions of zlib will throw an exception. -This creates a potential DOS vector, and as such the behavior ahs been reverted +This creates a potential DOS vector, and as such the behavior has been reverted in Node.js 8, 6, and 4. Node.js version 9 and higher will throw when windowBits is set to 8. diff --git a/doc/changelogs/CHANGELOG_V8.md b/doc/changelogs/CHANGELOG_V8.md index 0bf85c23c72055..f59758d1515380 100644 --- a/doc/changelogs/CHANGELOG_V8.md +++ b/doc/changelogs/CHANGELOG_V8.md @@ -6,6 +6,7 @@ +8.8.1
8.8.0
8.7.0
8.6.0
@@ -34,6 +35,30 @@ * [io.js](CHANGELOG_IOJS.md) * [Archive](CHANGELOG_ARCHIVE.md) + + ## 2017-10-25, Version 8.8.1 (Current), @cjihrig + + ### Notable Changes + + * **net**: + - Fix timeout with null handle issue. This is a regression in Node 8.8.0 [#16489](https://github.com/nodejs/node/pull/16489) + + ### Commits + + * [[`db8c92fb42`](https://github.com/nodejs/node/commit/db8c92fb42)] - **doc**: fix spelling in v8.8.0 changelog (Myles Borins) [#16477](https://github.com/nodejs/node/pull/16477) + * [[`c8396b8370`](https://github.com/nodejs/node/commit/c8396b8370)] - **doc**: remove loader hooks from unsupported features (Teppei Sato) [#16465](https://github.com/nodejs/node/pull/16465) + * [[`2b0bb57055`](https://github.com/nodejs/node/commit/2b0bb57055)] - **doc**: fix wrong URL (Jon Moss) [#16470](https://github.com/nodejs/node/pull/16470) + * [[`9ffc32974e`](https://github.com/nodejs/node/commit/9ffc32974e)] - **doc**: fix typo in changelog for 8.8.0 (Alec Perkins) [#16462](https://github.com/nodejs/node/pull/16462) + * [[`7facaa5031`](https://github.com/nodejs/node/commit/7facaa5031)] - **doc**: fix missing newline character (Daijiro Wachi) [#16447](https://github.com/nodejs/node/pull/16447) + * [[`16eb7d3a5f`](https://github.com/nodejs/node/commit/16eb7d3a5f)] - **doc**: fix doc styles (Daijiro Wachi) [#16385](https://github.com/nodejs/node/pull/16385) + * [[`99fdc1d04f`](https://github.com/nodejs/node/commit/99fdc1d04f)] - **doc**: add recommendations for first timers (Refael Ackermann) [#16350](https://github.com/nodejs/node/pull/16350) + * [[`6fbef7f350`](https://github.com/nodejs/node/commit/6fbef7f350)] - **doc**: fix typo in zlib.md (Luigi Pinca) [#16480](https://github.com/nodejs/node/pull/16480) + * [[`655e017e40`](https://github.com/nodejs/node/commit/655e017e40)] - **net**: fix timeout with null handle (Anatoli Papirovski) [#16489](https://github.com/nodejs/node/pull/16489) + * [[`7fad10cc7e`](https://github.com/nodejs/node/commit/7fad10cc7e)] - **test**: make test-v8-serdes work without stdin (Anna Henningsen) + * [[`12dc06e3e1`](https://github.com/nodejs/node/commit/12dc06e3e1)] - **test**: call toLowerCase on the resolved module (Daniel Bevenius) [#16486](https://github.com/nodejs/node/pull/16486) + * [[`10894c3835`](https://github.com/nodejs/node/commit/10894c3835)] - **test**: allow for different nsswitch.conf settings (Daniel Bevenius) [#16378](https://github.com/nodejs/node/pull/16378) + * [[`2a53165aa0`](https://github.com/nodejs/node/commit/2a53165aa0)] - **test**: add missing assertion (cjihrig) [#15519](https://github.com/nodejs/node/pull/15519) + ## 2017-10-24, Version 8.8.0 (Current), @MylesBorins @@ -42,8 +67,8 @@ * **crypto**: - expose ECDH class [#8188](https://github.com/nodejs/node/pull/8188) * **http2**: - - http2 is now exposed by defualt without the need for a flag [#15685](https://github.com/nodejs/node/pull/15685) - - a new environment varible NODE\_NO\_HTTP2 has been added to allow userland http2 to be required [#15685](https://github.com/nodejs/node/pull/15685) + - http2 is now exposed by default without the need for a flag [#15685](https://github.com/nodejs/node/pull/15685) + - a new environment variable NODE\_NO\_HTTP2 has been added to allow userland http2 to be required [#15685](https://github.com/nodejs/node/pull/15685) - support has been added for generic `Duplex` streams [#16269](https://github.com/nodejs/node/pull/16269) * **module**: - resolve and instantiate loader pipeline hooks have been added to the ESM lifecycle [#15445](https://github.com/nodejs/node/pull/15445) @@ -269,7 +294,7 @@ * [[`8e2064f093`](https://github.com/nodejs/node/commit/8e2064f093)] - **test**: fix ordering of strictEqual actual/expected (Chad Zezula) [#16008](https://github.com/nodejs/node/pull/16008) * [[`b054a4e138`](https://github.com/nodejs/node/commit/b054a4e138)] - **test**: use fixtures.path instead of fixturesDir (Matthew Meyer) [#15984](https://github.com/nodejs/node/pull/15984) * [[`68bfde9fb9`](https://github.com/nodejs/node/commit/68bfde9fb9)] - **test**: fix test-esm-addons (Rich Trott) [#16174](https://github.com/nodejs/node/pull/16174) -* [[`562d445999`](https://github.com/nodejs/node/commit/562d445999)] - **test**: use fixtures.readSync (szhang351) +* [[`562d445999`](https://github.com/nodejs/node/commit/562d445999)] - **test**: use fixtures.readSync (szhang351) * [[`1469eff8f6`](https://github.com/nodejs/node/commit/1469eff8f6)] - **test**: replaced fixturesDir with common.fixtures (Dolapo Toki) [#15836](https://github.com/nodejs/node/pull/15836) * [[`b463259efb`](https://github.com/nodejs/node/commit/b463259efb)] - **test**: use fixtures.fixturesDir (Gene Wu) [#15822](https://github.com/nodejs/node/pull/15822) * [[`1e0a55529f`](https://github.com/nodejs/node/commit/1e0a55529f)] - **test**: replaces fixturesDir with fixtures methods (Christian Murphy) [#15817](https://github.com/nodejs/node/pull/15817) @@ -576,7 +601,7 @@ * [[`94c6296d83`](https://github.com/nodejs/node/commit/94c6296d83)] - **tools**: use template literals (Sarah Meyer) [#15956](https://github.com/nodejs/node/pull/15956) * [[`eebb2d775a`](https://github.com/nodejs/node/commit/eebb2d775a)] - **(SEMVER-MINOR)** **tools, build**: refactor macOS installer (JP Wesselink) [#15179](https://github.com/nodejs/node/pull/15179) * [[`f68f572d7f`](https://github.com/nodejs/node/commit/f68f572d7f)] - **tty**: require readline at top of file (Bryan English) [#15647](https://github.com/nodejs/node/pull/15647) -* [[`d181147b2c`](https://genericithub.com/nodejs/node/commit/d181147b2c)] - **url**: const-ify APIs, and pass URL by ref (Sam Roberts) [#15615](https://github.com/nodejs/node/pull/15615) +* [[`d181147b2c`](https://github.com/nodejs/node/commit/d181147b2c)] - **url**: const-ify APIs, and pass URL by ref (Sam Roberts) [#15615](https://github.com/nodejs/node/pull/15615) * [[`1cc4245bfb`](https://github.com/nodejs/node/commit/1cc4245bfb)] - **url**: fix remaining calculation (Rimas Misevičius) [#15637](https://github.com/nodejs/node/pull/15637) * [[`34b4180d7d`](https://github.com/nodejs/node/commit/34b4180d7d)] - **url**: change variable name to be more descriptive (Yang-Kichang) [#15551](https://github.com/nodejs/node/pull/15551) * [[`58c68c2fcb`](https://github.com/nodejs/node/commit/58c68c2fcb)] - **util**: use faster -0 check (Brian White) [#15726](https://github.com/nodejs/node/pull/15726) diff --git a/doc/first_timer_badge.png b/doc/first_timer_badge.png new file mode 100644 index 00000000000000..d275a14851f286 Binary files /dev/null and b/doc/first_timer_badge.png differ diff --git a/doc/guides/writing-and-running-benchmarks.md b/doc/guides/writing-and-running-benchmarks.md index 880340ba93a5c8..1350b90e02ac97 100644 --- a/doc/guides/writing-and-running-benchmarks.md +++ b/doc/guides/writing-and-running-benchmarks.md @@ -438,4 +438,4 @@ Supported options keys are: [t-test]: https://en.wikipedia.org/wiki/Student%27s_t-test#Equal_or_unequal_sample_sizes.2C_unequal_variances [git-for-windows]: http://git-scm.com/download/win [nghttp2.org]: http://nghttp2.org -[benchmark-ci]: https://github.com/nodejs/benchmarking/blob/master/docs/core_benchmarks.md \ No newline at end of file +[benchmark-ci]: https://github.com/nodejs/benchmarking/blob/master/docs/core_benchmarks.md diff --git a/lib/net.js b/lib/net.js index bfafb915379fc3..ba67c3d2efaad9 100644 --- a/lib/net.js +++ b/lib/net.js @@ -396,13 +396,15 @@ Socket.prototype.setTimeout = function(msecs, callback) { Socket.prototype._onTimeout = function() { - // `.prevWriteQueueSize` !== `.updateWriteQueueSize()` means there is - // an active write in progress, so we suppress the timeout. - const prevWriteQueueSize = this._handle.writeQueueSize; - if (prevWriteQueueSize > 0 && - prevWriteQueueSize !== this._handle.updateWriteQueueSize()) { - this._unrefTimer(); - return; + if (this._handle) { + // `.prevWriteQueueSize` !== `.updateWriteQueueSize()` means there is + // an active write in progress, so we suppress the timeout. + const prevWriteQueueSize = this._handle.writeQueueSize; + if (prevWriteQueueSize > 0 && + prevWriteQueueSize !== this._handle.updateWriteQueueSize()) { + this._unrefTimer(); + return; + } } debug('_onTimeout'); this.emit('timeout'); diff --git a/src/node_version.h b/src/node_version.h index 5f3b9cd4e6fae9..ea9547137b79cd 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -24,7 +24,7 @@ #define NODE_MAJOR_VERSION 8 #define NODE_MINOR_VERSION 8 -#define NODE_PATCH_VERSION 1 +#define NODE_PATCH_VERSION 2 #define NODE_VERSION_IS_RELEASE 0 diff --git a/test/parallel/test-dgram-multicast-set-interface.js b/test/parallel/test-dgram-multicast-set-interface.js index c065683f53c7fd..2900cb89738e82 100644 --- a/test/parallel/test-dgram-multicast-set-interface.js +++ b/test/parallel/test-dgram-multicast-set-interface.js @@ -33,11 +33,14 @@ const dgram = require('dgram'); socket.bind(0); socket.on('listening', common.mustCall(() => { // Try to set with an invalid interfaceAddress (wrong address class) + // + // This operation succeeds on some platforms, throws `EINVAL` on some + // platforms, and throws `ENOPROTOOPT` on others. This is unpleasant, but + // we should at least test for it. try { socket.setMulticastInterface('::'); - throw new Error('Not detected.'); } catch (e) { - console.error(`setMulticastInterface: wrong family error is: ${e}`); + assert(e.code === 'EINVAL' || e.code === 'ENOPROTOOPT'); } socket.close(); diff --git a/test/parallel/test-https-connect-address-family.js b/test/parallel/test-https-connect-address-family.js index fa9baa528efa00..a345a70a57074b 100644 --- a/test/parallel/test-https-connect-address-family.js +++ b/test/parallel/test-https-connect-address-family.js @@ -33,7 +33,7 @@ function runTest() { dns.lookup('localhost', { family: 6, all: true }, (err, addresses) => { if (err) { - if (err.code === 'ENOTFOUND') + if (err.code === 'ENOTFOUND' || err.code === 'EAI_AGAIN') common.skip('localhost does not resolve to ::1'); throw err; diff --git a/test/parallel/test-net-better-error-messages-port-hostname.js b/test/parallel/test-net-better-error-messages-port-hostname.js index dac17141677dcb..818ea4bfff41f6 100644 --- a/test/parallel/test-net-better-error-messages-port-hostname.js +++ b/test/parallel/test-net-better-error-messages-port-hostname.js @@ -9,7 +9,13 @@ const c = net.createConnection(0, 'this.hostname.is.invalid'); c.on('connect', common.mustNotCall()); c.on('error', common.mustCall(function(e) { - assert.strictEqual(e.code, 'ENOTFOUND'); + // If Name Service Switch is available on the operating system then it + // might be configured differently (/etc/nsswitch.conf). + // If the system is configured with no dns the error code will be EAI_AGAIN, + // but if there are more services after the dns entry, for example some + // linux distributions ship a myhostname service by default which would + // still produce the ENOTFOUND error. + assert.ok(e.code === 'ENOTFOUND' || e.code === 'EAI_AGAIN'); assert.strictEqual(e.port, 0); assert.strictEqual(e.hostname, 'this.hostname.is.invalid'); })); diff --git a/test/parallel/test-net-connect-immediate-finish.js b/test/parallel/test-net-connect-immediate-finish.js index 1b65ce15ab8a1c..e2e5e1c6715b9a 100644 --- a/test/parallel/test-net-connect-immediate-finish.js +++ b/test/parallel/test-net-connect-immediate-finish.js @@ -32,7 +32,13 @@ const client = net.connect({ client.once('error', common.mustCall((err) => { assert(err); assert.strictEqual(err.code, err.errno); - assert.strictEqual(err.code, 'ENOTFOUND'); + // If Name Service Switch is available on the operating system then it + // might be configured differently (/etc/nsswitch.conf). + // If the system is configured with no dns the error code will be EAI_AGAIN, + // but if there are more services after the dns entry, for example some + // linux distributions ship a myhostname service by default which would + // still produce the ENOTFOUND error. + assert.ok(err.code === 'ENOTFOUND' || err.code === 'EAI_AGAIN'); assert.strictEqual(err.host, err.hostname); assert.strictEqual(err.host, 'this.hostname.is.invalid'); assert.strictEqual(err.syscall, 'getaddrinfo'); diff --git a/test/parallel/test-net-timeout-no-handle.js b/test/parallel/test-net-timeout-no-handle.js new file mode 100644 index 00000000000000..539f661cae8414 --- /dev/null +++ b/test/parallel/test-net-timeout-no-handle.js @@ -0,0 +1,17 @@ +'use strict'; + +const common = require('../common'); +const net = require('net'); +const assert = require('assert'); + +const socket = new net.Socket(); +socket.setTimeout(common.platformTimeout(50)); + +socket.on('timeout', common.mustCall(() => { + assert.strictEqual(socket._handle, null); +})); + +socket.on('connect', common.mustNotCall()); + +// since the timeout is unrefed, the code will exit without this +setTimeout(() => {}, common.platformTimeout(200)); diff --git a/test/parallel/test-require-resolve.js b/test/parallel/test-require-resolve.js index 77f07b394fcc64..b897936696d20d 100644 --- a/test/parallel/test-require-resolve.js +++ b/test/parallel/test-require-resolve.js @@ -32,7 +32,7 @@ assert.strictEqual( require.resolve(fixtures.path('a')).toLowerCase()); assert.strictEqual( fixtures.path('nested-index', 'one', 'index.js').toLowerCase(), - require.resolve(fixtures.path('nested-index', 'one').toLowerCase())); + require.resolve(fixtures.path('nested-index', 'one')).toLowerCase()); assert.strictEqual('path', require.resolve('path')); console.log('ok'); diff --git a/test/parallel/test-tls-connect-address-family.js b/test/parallel/test-tls-connect-address-family.js index 663e9399b610ce..b0623c6cf603ec 100644 --- a/test/parallel/test-tls-connect-address-family.js +++ b/test/parallel/test-tls-connect-address-family.js @@ -32,7 +32,7 @@ function runTest() { dns.lookup('localhost', { family: 6, all: true }, (err, addresses) => { if (err) { - if (err.code === 'ENOTFOUND') + if (err.code === 'ENOTFOUND' || err.code === 'EAI_AGAIN') common.skip('localhost does not resolve to ::1'); throw err; diff --git a/test/parallel/test-v8-serdes.js b/test/parallel/test-v8-serdes.js index 981e196157812f..ad8666ee3ba877 100644 --- a/test/parallel/test-v8-serdes.js +++ b/test/parallel/test-v8-serdes.js @@ -20,6 +20,8 @@ const objects = [ circular ]; +const hostObject = new (process.binding('js_stream').JSStream)(); + const serializerTypeError = /^TypeError: Class constructor Serializer cannot be invoked without 'new'$/; const deserializerTypeError = @@ -63,8 +65,8 @@ const deserializerTypeError = { const ser = new v8.DefaultSerializer(); ser._writeHostObject = common.mustCall((object) => { - assert.strictEqual(object, process.stdin._handle); - const buf = Buffer.from('stdin'); + assert.strictEqual(object, hostObject); + const buf = Buffer.from('hostObjectTag'); ser.writeUint32(buf.length); ser.writeRawBytes(buf); @@ -74,23 +76,23 @@ const deserializerTypeError = }); ser.writeHeader(); - ser.writeValue({ val: process.stdin._handle }); + ser.writeValue({ val: hostObject }); const des = new v8.DefaultDeserializer(ser.releaseBuffer()); des._readHostObject = common.mustCall(() => { const length = des.readUint32(); const buf = des.readRawBytes(length); - assert.strictEqual(buf.toString(), 'stdin'); + assert.strictEqual(buf.toString(), 'hostObjectTag'); assert.deepStrictEqual(des.readUint64(), [1, 2]); assert.strictEqual(des.readDouble(), -0.25); - return process.stdin._handle; + return hostObject; }); des.readHeader(); - assert.strictEqual(des.readValue().val, process.stdin._handle); + assert.strictEqual(des.readValue().val, hostObject); } { @@ -101,12 +103,12 @@ const deserializerTypeError = ser.writeHeader(); assert.throws(() => { - ser.writeValue({ val: process.stdin._handle }); + ser.writeValue({ val: hostObject }); }, /foobar/); } { - assert.throws(() => v8.serialize(process.stdin._handle), + assert.throws(() => v8.serialize(hostObject), /^Error: Unknown host object type: \[object .*\]$/); }