From aa98dd0b94d7a3f9baa11a883368773c1dd6fd99 Mon Sep 17 00:00:00 2001 From: Vladimir Morozov Date: Fri, 16 Jan 2026 14:00:45 -0800 Subject: [PATCH 1/2] tools: fix vcbuild lint-js-build PR-URL: https://github.com/nodejs/node/pull/61318 Reviewed-By: Yagiz Nizipli Reviewed-By: Aviv Keller Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Chengzhong Wu Reviewed-By: Stefan Stojanovic --- vcbuild.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcbuild.bat b/vcbuild.bat index 9f324c7e5b8ae0..4bfcc1ae073cea 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -749,7 +749,7 @@ if errorlevel 1 goto exit goto lint-cpp :lint-cpp -if not defined lint_cpp goto lint-js +if not defined lint_cpp goto lint-js-build if defined NODEJS_MAKE goto run-make-lint where make > NUL 2>&1 && make -v | findstr /C:"GNU Make" 1> NUL if "%ERRORLEVEL%"=="0" set "NODEJS_MAKE=make PYTHON=python" & goto run-make-lint @@ -757,7 +757,7 @@ where wsl > NUL 2>&1 if "%ERRORLEVEL%"=="0" set "NODEJS_MAKE=wsl make" & goto run-make-lint echo Could not find GNU Make, needed for linting C/C++ echo Alternatively, you can use WSL -goto lint-js +goto lint-js-build :run-make-lint %NODEJS_MAKE% lint-cpp From 955d34788415738a0bdc7c91e61384bbf30fa5ac Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Sat, 17 Jan 2026 02:12:45 +0100 Subject: [PATCH 2/2] assert,util: fix deep comparison for sets and maps with mixed types When comparing a Set or a Map and they contain primitives as keys as well as objects, the primitives would always be skipped. That is not correct, since that may only be skipped in case all keys are objects. Fixes: https://github.com/nodejs/node/issues/61386 PR-URL: https://github.com/nodejs/node/pull/61388 Reviewed-By: Aviv Keller Reviewed-By: Colin Ihrig Reviewed-By: Jordan Harband --- lib/internal/util/comparisons.js | 17 +++++++++++------ test/parallel/test-assert-deep.js | 15 +++++++++++++++ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/lib/internal/util/comparisons.js b/lib/internal/util/comparisons.js index 754e0b1d5d44bd..a8d5178242fdc8 100644 --- a/lib/internal/util/comparisons.js +++ b/lib/internal/util/comparisons.js @@ -669,8 +669,10 @@ function setObjectEquiv(array, a, b, mode, memo) { if (b.has(val1)) { continue; } - } else if (mode !== kLoose || b.has(val1)) { + } else if (b.has(val1)) { continue; + } else if (mode !== kLoose) { + return false; } } @@ -816,11 +818,14 @@ function mapObjectEquiv(array, a, b, mode, memo) { const extraChecks = mode === kLoose || array.length !== a.size; for (const { 0: key1, 1: item1 } of a) { - if (extraChecks && - (typeof key1 !== 'object' || key1 === null) && - (mode !== kLoose || - (b.has(key1) && innerDeepEqual(item1, b.get(key1), mode, memo)))) { // Mixed mode - continue; + if (extraChecks && (typeof key1 !== 'object' || key1 === null)) { + if (b.has(key1)) { + if (mode !== kLoose || innerDeepEqual(item1, b.get(key1), mode, memo)) { + continue; + } + } else if (mode !== kLoose) { + return false; + } } let innerStart = start; diff --git a/test/parallel/test-assert-deep.js b/test/parallel/test-assert-deep.js index 9c1d8eefe09252..c1a42aa4de624d 100644 --- a/test/parallel/test-assert-deep.js +++ b/test/parallel/test-assert-deep.js @@ -634,6 +634,21 @@ test('Handle sparse arrays', () => { assertNotDeepOrStrict(a, b, AssertionError, { partial: 'pass' }); }); +test('Handle sets and maps with mixed keys', () => { + // https://github.com/nodejs/node/issues/61386 + const aSet = new Set([0, new Set([1, 2, 3]), new Set([4, 5, 6])]); + const bSet = new Set([ + 0, + new Set([1, new Set([2, 3]), new Set([20, 30])]), + new Set([4, new Set([5, 6]), new Set([50, 60])]), + ]); + assertNotDeepOrStrict(aSet, bSet); + + const aMap = new Map([[0, 'zero'], [1, 'one'], [new Set([1, 2, 3]), 'A']]); + const bMap = new Map([[0, 'zero'], [new Set([1, 2, 3]), 'A'], [new Set([9]), 'B']]); + assertNotDeepOrStrict(aMap, bMap); +}); + test('Handle different error messages', () => { const err1 = new Error('foo1'); assertNotDeepOrStrict(err1, new Error('foo2'), assert.AssertionError);