Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

2024-11-20, Version 23.3.0 (Current), @RafaelGSS #55921

Merged
merged 56 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
1f2fcf1
doc: add history entries for JSON modules stabilization
aduh95 Nov 16, 2024
00e092b
util: fix util.getCallSites plurality
legendecas Nov 2, 2024
d4e7926
util: add sourcemap support to getCallSites
marco-ippolito Nov 4, 2024
7814669
tools: fix c-ares updater script for Node.js 18
richardlau Nov 6, 2024
bbb8f59
lib: use `Promise.withResolvers()` in timers
anonrig Nov 6, 2024
e147935
deps: update icu to 76.1
nodejs-github-bot Nov 7, 2024
cfe28b1
lib: remove unnecessary optional chaining
gurgunday Nov 7, 2024
d1ad43e
test: improve test coverage for `ServerResponse`
juanarbol Nov 7, 2024
5767b76
doc: enforce strict policy to semver-major releases
RafaelGSS Nov 7, 2024
e1b42e7
test: add buffer to fs_permission tests
RafaelGSS Nov 7, 2024
1568733
lib: prefer symbol to number in webidl `type` function
aduh95 Nov 7, 2024
9862912
assert: differentiate cases where `cause` is `undefined` or missing
aduh95 Nov 8, 2024
e1f54e2
test: ensure that test priority is not higher than current priority
LiviaMedeiros Nov 8, 2024
8576ca9
doc: clarify removal of experimental API does not require a deprecation
aduh95 Nov 8, 2024
db0d648
fs: fix bufferSize option for opendir recursive
Ethan-Arrowood Nov 8, 2024
3a9733c
util: do not mark experimental feature as deprecated
aduh95 Nov 8, 2024
84c4747
test: improve test coverage for child process message sending
juanarbol Nov 8, 2024
ccb69bb
src: add cli option to preserve env vars on dr
RafaelGSS Nov 8, 2024
16786a6
src: improve `node:os` userInfo performance
anonrig Nov 8, 2024
aa12de0
doc: sort --report-exclude alphabetically
RafaelGSS Nov 9, 2024
419ea06
tools: remove non-existent file from eslint config
Nov 10, 2024
8111a76
tools: make commit-queue check blocked label
marco-ippolito Nov 10, 2024
3cfacd3
tools: fix exclude labels for commit-queue
richardlau Nov 10, 2024
bba7323
build: apply cpp linting and formatting to ncrypto
Nov 10, 2024
7773567
build: use glob for dependencies of out/Makefile
richardlau Nov 10, 2024
df5ea1a
doc: clarify triager role
gireeshpunathil Nov 10, 2024
472d55e
build: implement node_use_amaro flag in GN build
zcbenz Nov 11, 2024
9aeb671
doc: run license-builder
github-actions[bot] Nov 11, 2024
83ba688
esm: fix import.meta.resolve crash
marco-ippolito Nov 11, 2024
9c99255
permission: ignore internalModuleStat on module loading
RafaelGSS Nov 11, 2024
c210335
benchmark: add `test_runner/mock-fn`
Nov 11, 2024
e0db9ed
deps: update c-ares to v1.34.3
nodejs-github-bot Nov 12, 2024
5a437c4
report: fix network queries in getReport libuv with exclude-network
Tofandel Nov 12, 2024
770670c
test: fix permission fixtures lint
RafaelGSS Nov 12, 2024
65ffb2c
doc: update unflag info of `import.meta.resolve`
skyclouds2001 Nov 12, 2024
c5afdaf
doc: correct max-semi-space-size statement
joebowbeer Nov 12, 2024
11e1bdd
module: tidy code string concat → string templates
JakobJingleheimer Nov 13, 2024
e56265c
doc: fix history info for `URL.prototype.toJSON`
aduh95 Nov 13, 2024
787e51e
doc: add notable-change mention to sec release
RafaelGSS Nov 14, 2024
bdb6d12
events: add hasEventListener util for validate
sungpaks Nov 14, 2024
a831184
doc: clarify UV_THREADPOOL_SIZE env var usage
preveen-stack Nov 15, 2024
1b863b9
doc: add `-S` flag release preparation example
aduh95 Nov 15, 2024
32e5bbc
benchmark: add `test-reporters`
Nov 16, 2024
ec953bc
doc: add `node:sqlite` to mandatory `node:` prefix list
sapphi-red Nov 16, 2024
e0ef65b
doc: remove non-working example
aduh95 Nov 16, 2024
dc8aca3
deps: update undici to 6.21.0
nodejs-github-bot Nov 16, 2024
cad557e
deps: update simdutf to 5.6.1
nodejs-github-bot Nov 16, 2024
58d7a6e
Revert "src: migrate `String::Value` to `String::ValueView`"
targos Nov 16, 2024
49d5522
src: use env strings to create sqlite results
targos Nov 17, 2024
034505e
test_runner: error on mocking an already mocked date
Nov 17, 2024
d41cb49
fs: prevent unwanted `dependencyOwners` removal
Ceres6 Nov 17, 2024
e0c2225
crypto: allow length=0 for HKDF and PBKDF2 in SubtleCrypto.deriveBits
panva Nov 17, 2024
44324aa
tools: bump @eslint/plugin-kit from 0.2.0 to 0.2.3 in /tools/eslint
dependabot[bot] Nov 17, 2024
bcbba72
sqlite: add support for SQLite Session Extension
louwers Nov 18, 2024
693fda0
lib: remove unused file `fetch_module`
targos Nov 18, 2024
72f82ad
2024-11-20, Version 23.3.0 (Current)
RafaelGSS Nov 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
assert: differentiate cases where cause is undefined or missing
PR-URL: #55738
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
aduh95 committed Nov 16, 2024
commit 9862912d416b3dd931189e6b0409c15641017250
5 changes: 3 additions & 2 deletions lib/internal/assert/assertion_error.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const {
ObjectAssign,
ObjectDefineProperty,
ObjectGetPrototypeOf,
ObjectPrototypeHasOwnProperty,
String,
StringPrototypeRepeat,
StringPrototypeSlice,
Expand Down Expand Up @@ -49,8 +50,8 @@ function copyError(source) {
__proto__: null,
value: source.message,
});
if (source.cause !== undefined) {
let cause = source.cause;
if (ObjectPrototypeHasOwnProperty(source, 'cause')) {
let { cause } = source;

if (isError(cause)) {
cause = copyError(cause);
Expand Down
9 changes: 6 additions & 3 deletions lib/internal/util/comparisons.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const {
const { compare } = internalBinding('buffer');
const assert = require('internal/assert');
const { isURL } = require('internal/url');
const { isError } = require('internal/util');
const types = require('internal/util/types');
const {
isAnyArrayBuffer,
Expand Down Expand Up @@ -235,10 +236,10 @@ function innerDeepEqual(val1, val2, strict, memos) {
if (!isAnyArrayBuffer(val2) || !areEqualArrayBuffers(val1, val2)) {
return false;
}
} else if (isNativeError(val1) || val1 instanceof Error) {
} else if (isError(val1)) {
// Do not compare the stack as it might differ even though the error itself
// is otherwise identical.
if (!isNativeError(val2) && !(val2 instanceof Error)) {
if (!isError(val2)) {
return false;
}

Expand All @@ -252,7 +253,9 @@ function innerDeepEqual(val1, val2, strict, memos) {
(name1Enumerable !== ObjectPrototypePropertyIsEnumerable(val2, 'name') ||
(!name1Enumerable && val1.name !== val2.name)) ||
(cause1Enumerable !== ObjectPrototypePropertyIsEnumerable(val2, 'cause') ||
(!cause1Enumerable && !innerDeepEqual(val1.cause, val2.cause, strict, memos))) ||
(!cause1Enumerable && (
ObjectPrototypeHasOwnProperty(val1, 'cause') !== ObjectPrototypeHasOwnProperty(val2, 'cause') ||
!innerDeepEqual(val1.cause, val2.cause, strict, memos)))) ||
(errors1Enumerable !== ObjectPrototypePropertyIsEnumerable(val2, 'errors') ||
(!errors1Enumerable && !innerDeepEqual(val1.errors, val2.errors, strict, memos)))) {
return false;
Expand Down
43 changes: 43 additions & 0 deletions test/parallel/test-assert-deep-with-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,26 @@ const defaultStartMessage = 'Expected values to be strictly deep-equal:\n' +
'\n';

test('Handle error causes', () => {
assert.deepStrictEqual(new Error('a', { cause: new Error('x') }), new Error('a', { cause: new Error('x') }));
assert.deepStrictEqual(
new Error('a', { cause: new RangeError('x') }),
new Error('a', { cause: new RangeError('x') }),
);

assert.throws(() => {
assert.deepStrictEqual(new Error('a', { cause: new Error('x') }), new Error('a', { cause: new Error('y') }));
}, { message: defaultStartMessage + ' [Error: a] {\n' +
'+ [cause]: [Error: x]\n' +
'- [cause]: [Error: y]\n' +
' }\n' });

assert.throws(() => {
assert.deepStrictEqual(new Error('a', { cause: new Error('x') }), new Error('a', { cause: new TypeError('x') }));
}, { message: defaultStartMessage + ' [Error: a] {\n' +
'+ [cause]: [Error: x]\n' +
'- [cause]: [TypeError: x]\n' +
' }\n' });

assert.throws(() => {
assert.deepStrictEqual(new Error('a'), new Error('a', { cause: new Error('y') }));
}, { message: defaultStartMessage + '+ [Error: a]\n' +
Expand All @@ -37,3 +50,33 @@ test('Handle error causes', () => {
new Error('a', { cause: { prop: 'a different value' } })
);
});

test('Handle undefined causes', () => {
assert.deepStrictEqual(new Error('a', { cause: undefined }), new Error('a', { cause: undefined }));

assert.notDeepStrictEqual(new Error('a', { cause: 'undefined' }), new Error('a', { cause: undefined }));
assert.notDeepStrictEqual(new Error('a', { cause: undefined }), new Error('a'));
assert.notDeepStrictEqual(new Error('a'), new Error('a', { cause: undefined }));

assert.throws(() => {
assert.deepStrictEqual(new Error('a'), new Error('a', { cause: undefined }));
}, { message: defaultStartMessage +
'+ [Error: a]\n' +
'- [Error: a] {\n' +
'- [cause]: undefined\n' +
'- }\n' });

assert.throws(() => {
assert.deepStrictEqual(new Error('a', { cause: undefined }), new Error('a'));
}, { message: defaultStartMessage +
'+ [Error: a] {\n' +
'+ [cause]: undefined\n' +
'+ }\n' +
'- [Error: a]\n' });
assert.throws(() => {
assert.deepStrictEqual(new Error('a', { cause: undefined }), new Error('a', { cause: 'undefined' }));
}, { message: defaultStartMessage + ' [Error: a] {\n' +
'+ [cause]: undefined\n' +
'- [cause]: \'undefined\'\n' +
' }\n' });
});