Skip to content

Conversation

@targos
Copy link
Member

@targostargos commented May 4, 2020

2020-05-05, Version 14.2.0 (Current), @targos

Notable Changes

Track function calls with assert.CallTracker (experimental)

assert.CallTracker is a new experimental API that allows to track and later
verify the number of times a function was called. This works by creating a
CallTracker object and using its calls method to create wrapper functions
that will count each time they are called. Then the verify method can be used
to assert that the expected number of calls happened:

constassert=require('assert');consttracker=newassert.CallTracker();functionfunc(){}// callsfunc() must be called exactly twice before tracker.verify().constcallsfunc=tracker.calls(func,2);callsfunc();callsfunc();functionotherFunc(){}// The second parameter defaults to `1`.constcallsotherFunc=tracker.calls(otherFunc);callsotherFunc();// Calls tracker.verify() and verifies if all tracker.calls() functions have// been called the right number of times.process.on('exit',()=>{tracker.verify();});

Additionally, tracker.report() will return an array which contains information
about the errors, if there are any:

constassert=require('assert');consttracker=newassert.CallTracker();functionfunc(){}constcallsfunc=tracker.calls(func);console.log(tracker.report());/*[{ message: 'Expected the func function to be executed 1 time(s) but was executed 0 time(s).', actual: 0, expected: 1, operator: 'func', stack: Error ... }]*/

Contributed by ConorDavenport - #31982.

Console groupIndentation option

The Console constructor (require('console').Console) now supports different group indentations.

This is useful in case you want different grouping width than 2 spaces.

const{ Console }=require('console');constcustomConsole=newConsole({stdout: process.stdout,stderr: process.stderr,groupIndentation: 10});customConsole.log('foo');// 'foo'customConsole.group();customConsole.log('foo');// 'foo'

Contributed by rickyes - #32964.

DavenportEmmaand others added 30 commits May 4, 2020 14:23
Fixes: #31392 PR-URL: #31982 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Zeyu Yang <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Denys Otrishko <[email protected]>
Fixes: #32806 PR-URL: #32810 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
The links for the ArrayBufferView and WebAssembly.Instance types appear to be broken. This commit updates them to point to the correct MDN locations. PR-URL: #33068 Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
Upstream WASI has renamed __wasi_unstable_reactor_start() to _initialize(). This commit updates Node's WASI implementation to reflect that change. PR-URL: #33073 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
_start() and _initialize() shouldn't be called from the same function, as they have different behavior. Furthermore, Node should throw if both are provided. This commit updates the implementation, docs, and tests accordingly. PR-URL: #33073 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
This release focuses on improving the robustness of the path resolution and sandboxing, including adding support for relative preopen paths. PR-URL: #33078 Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: #32942 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
Instead of holding shared pointers to ArrayBuffers, simplify the code by using AliasedBuffers directly which allows the binding to own the buffers. PR-URL: #32929 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: #32861Fixes: #32857 Reviewed-By: Zeyu Yang <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Refs: #28803 PR-URL: #32849 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Test name test-worker-message-port-message-before-close is too long for a commit message description. Refs: #31280 PR-URL: #32849 Refs: #28803 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Some small fixes on HTTP/2 and its documentation: - Add a note that, on server streams, it's not necessary to start data flow. - Set EOF flag if we have marked all data for sending: there's no need to wait until the queue is actually empty (and send a separate, empty DATA). (Note that, even with this change, a separate DATA frame will always be sent, because the streams layer waits until data has been flushed before dispatching EOF) PR-URL: #28044 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Avoid sending multiple `exitedAfterDisconnect` messages when concurrently calling `disconnect()` and/or `destroy()` from the worker so `ERR_IPC_DISCONNECTED` errors are not generated. Fixes: #32106 PR-URL: #32793 Reviewed-By: Zeyu Yang <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
The JS code accepted any value where `typeof sizeOrKey === 'number'` was true but the C++ code checked that `args[0]->IsInt32()` and subsequently aborted. Fixes: #32738 PR-URL: #32739 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Zeyu Yang <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
Validate the generator argument in `crypto.createDiffieHellman(key, g)`. When it's a number, it should be an int32. Fixes: #32748 PR-URL: #32739Fixes: #32738 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Zeyu Yang <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
It's possible to pass in the prime and generator params as buffers but that mode of input wasn't as rigorously checked as numeric input. PR-URL: #32739Fixes: #32738 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Zeyu Yang <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #32964Fixes: #32947 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #33077 Reviewed-By: Zeyu Yang <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #33072 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Richard Lau <[email protected]>
PR-URL: #33067 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]>
uv_idle_init(), uv_idle_start() and uv_idle_stop() always succeed. Remove the superfluous error handling. Refs: libuv/libuv#2803 PR-URL: #32997 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #32996 Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: #32956 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
Instead of reimplementing Writable properties, fetch them from the Writable prototype. PR-URL: #33079 Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: #33081 Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]>
In the worker pool example, the 'kWorkerFreedEvent' should be emitted in case of error as well. After adding new worker in the error handler, the pending tasks should be notified of an available worker. PR-URL: #33082 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]>
Fix the 'uncaugth' typo in the test name. PR-URL: #33083 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]>
Mostly, this introduces a pattern that makes sure that if a custom error is reported, `stopped_` will be set to `true` correctly in every cast, which was previously missing for the `NewContext().IsEmpty()` case (which led to a hard crash from the `Worker` destructor). This also leaves TODO comments for a few cases in which `ERR_WORKER_OUT_OF_MEMORY` was not used in accordance with the documentation for that error code (or according to its intention). Fixing that is semver-major. PR-URL: #33084 Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Add `stackSizeMb` to the `resourceLimit` option group. Refs: #31593 (comment) PR-URL: #33085 Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Throws `ERR_STREAM_NULL_VALUES` error if a null value is passed to `Readable.from`. Also added docs for the same. Co-Authored-By: 扩散性百万甜面包 <[email protected]> Fixes: #32845 PR-URL: #32873 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
targos added a commit that referenced this pull request May 4, 2020
Notable changes: * Track function calls with `assert.CallTracker` (experimental). #31982 PR-URL: #33232
@targostargosforce-pushed the v14.2.0-proposal branch from e84a5a4 to c1e8bc0CompareMay 4, 2020 18:16
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented May 4, 2020

@nodejs-github-bot
Copy link
Collaborator

@targos
Copy link
MemberAuthor

@nodejs/testing test.parallel/test-https-foafssl failed twice in a row. Is it a known flake?

@nodejs-github-bot
Copy link
Collaborator

@mcollina
Copy link
Member

May I get a link to a Windows build of this? I would like to test if this solves #33166 by any chance.

@targos
Copy link
MemberAuthor

targos commented May 5, 2020

@targos
Copy link
MemberAuthor

@BridgeAR
Copy link
Member

BridgeAR commented May 5, 2020

@targos here's a description for the console change:

Console groupIndentation option

The Console constructor (require('console').Console) now supports different group indentations.

This is useful in case you want different grouping width than 2 spaces.

const{ Console }=require('console');constownConsole=newConsole({stdout: process.stdout,stderr: process.stderr,groupIndentation: 10});ownConsole.log('foo');// 'foo'ownConsole.group();ownConsole.log('foo');// 'foo'

Notable changes: * Track function calls with `assert.CallTracker` (experimental). #31982 * Added a `groupIndentation` option to the `Console` constructor. #32964 PR-URL: #33232
@targostargosforce-pushed the v14.2.0-proposal branch from c1e8bc0 to d68f78fCompareMay 5, 2020 17:18
@targos
Copy link
MemberAuthor

@targostargos merged commit d68f78f into v14.xMay 5, 2020
targos added a commit that referenced this pull request May 5, 2020
@targostargos deleted the v14.2.0-proposal branch May 5, 2020 18:23
targos added a commit that referenced this pull request May 5, 2020
Notable changes: * Track function calls with `assert.CallTracker` (experimental). #31982 * Added a `groupIndentation` option to the `Console` constructor. #32964 PR-URL: #33232
targos added a commit to nodejs/nodejs.org that referenced this pull request May 5, 2020
targos added a commit to nodejs/nodejs.org that referenced this pull request May 5, 2020
@addaleax
Copy link
Member

I really like the commit grouping here btw :)

@targostargos added release Issues and PRs related to Node.js releases. and removed build Issues and PRs related to build files or the CI. meta Issues and PRs related to the general management of the project. v8 engine Issues and PRs related to the V8 dependency. wasi Issues and PRs related to the WebAssembly System Interface. labels Jun 6, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

releaseIssues and PRs related to Node.js releases.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

20 participants

@targos@nodejs-github-bot@mcollina@BridgeAR@addaleax@codebytere@cjihrig@BethGriggs@DavenportEmma@himself65@thecodrr@joyeecheung@rickyes@sam-github@mildsunrise@santigimeno@bnoordhuis@Trott@juanarbol@ronag