mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
## Summary - Fixes `assert.deepStrictEqual()` to properly compare Number and Boolean wrapper objects - Previously, `new Number(1)` and `new Number(2)` were incorrectly considered equal because they have no enumerable properties - Now correctly extracts and compares internal values using `JSC::sameValue()`, then falls through to check own properties ## Test plan - [x] Run `bun bd test test/regression/issue/24045.test.ts` - all 6 tests pass - [x] Verify tests fail with system Bun (`USE_SYSTEM_BUN=1`) to confirm fix validity - [x] Verified behavior matches Node.js exactly (see table below) ## Node.js Compatibility | Test Case | Node.js | Bun | |-----------|---------|-----| | Different Number values (`new Number(1)` vs `new Number(2)`) | throws | throws | | Same Number values (`new Number(1)` vs `new Number(1)`) | equal | equal | | 0 vs -0 (`new Number(0)` vs `new Number(-0)`) | throws | throws | | NaN equals NaN (`new Number(NaN)` vs `new Number(NaN)`) | equal | equal | | Different Boolean values (`new Boolean(true)` vs `new Boolean(false)`) | throws | throws | | Same Boolean values | equal | equal | | Number wrapper vs primitive (`new Number(1)` vs `1`) | throws | throws | | Number vs Boolean wrapper | throws | throws | | Same value, different own properties | throws | throws | | Same value, same own properties | equal | equal | | Different own property values | throws | throws | ## Example Before (bug): ```javascript assert.deepStrictEqual(new Number(1), new Number(2)); // passes incorrectly ``` After (fixed): ```javascript assert.deepStrictEqual(new Number(1), new Number(2)); // throws AssertionError ``` Closes #24045 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
3.5 KiB
3.5 KiB