Skip to content

fix(ext/node): fix multiple deepEqual comparison issues#32763

Merged
bartlomieju merged 1 commit intomainfrom
fix/node-compat-assert-deep
Mar 16, 2026
Merged

fix(ext/node): fix multiple deepEqual comparison issues#32763
bartlomieju merged 1 commit intomainfrom
fix/node-compat-assert-deep

Conversation

@bartlomieju
Copy link
Copy Markdown
Member

Summary

Fixes test-assert-deep.js compat test from #32706.

  • Invalid dates: Fix NaN !== NaN comparison by using NumberIsNaN for Date.getTime() results, so two invalid dates with the same properties are considered deeply equal
  • Date type check order: Check isDate(val2) before calling DatePrototypeGetTime(val2) to prevent TypeError on non-Date objects with [Symbol.toStringTag] = 'Date'
  • Loose array comparison: Allow null and undefined to be loosely equal in arrays by deferring to innerDeepEqual in loose mode instead of short-circuiting
  • Set comparison: Fix setObjectEquiv to properly reject non-matching primitives in strict mode (was incorrectly continuing instead of returning false)
  • Map comparison: Fix mapObjectEquiv with same pattern — check b.has(key1) before skipping primitive keys
  • Promise comparison: Two different Promise instances are now only equal by reference, not structurally

Enabled tests

  • test-assert-deep.js (all 52 subtests pass)

Test plan

  • test-assert-deep.js passes via ./x test-compat
  • CI passes

🤖 Generated with Claude Code

@bartlomieju bartlomieju requested a review from Tango992 March 15, 2026 21:26
@bartlomieju bartlomieju changed the title fix(node/assert): fix multiple deepEqual comparison issues fix(ext/node): fix multiple deepEqual comparison issues Mar 15, 2026
- Fix invalid Date comparison (NaN !== NaN) by using NumberIsNaN
- Fix Date type check order to prevent TypeError on non-Date objects
- Fix loose array comparison for null/undefined equivalence
- Fix setObjectEquiv to properly reject non-matching primitives in
  strict mode instead of skipping them
- Fix mapObjectEquiv with same pattern for Map key comparison
- Reject Promise comparison by reference only (not structurally)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bartlomieju bartlomieju force-pushed the fix/node-compat-assert-deep branch from 55fc182 to 5a28d84 Compare March 15, 2026 21:34
Copy link
Copy Markdown
Contributor

@Tango992 Tango992 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bartlomieju bartlomieju merged commit 60edd78 into main Mar 16, 2026
112 checks passed
@bartlomieju bartlomieju deleted the fix/node-compat-assert-deep branch March 16, 2026 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants