Skip to content

Commit 84b192e

Browse files
authored
fix(ext/node): fix deepStrictEqual(-0, 0) (#29060)
1 parent 733ffd9 commit 84b192e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

ext/node/polyfills/_util/std_asserts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export function equal(c: unknown, d: unknown): boolean {
103103
return aTime === bTime;
104104
}
105105
if (typeof a === "number" && typeof b === "number") {
106-
return NumberIsNaN(a) && NumberIsNaN(b) || a === b;
106+
return ObjectIs(a, b);
107107
}
108108
if (ObjectIs(a, b)) {
109109
return true;

tests/unit_node/assert_test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,11 @@ Deno.test("[node/assert] .throws() compares Error instance", () => {
1616
TypeError,
1717
);
1818
});
19+
20+
Deno.test("[node/assert] deepStrictEqual(0, -0)", () => {
21+
assert.throws(
22+
() => {
23+
assert.deepStrictEqual(0, -0);
24+
},
25+
);
26+
});

0 commit comments

Comments
 (0)