diff --git a/ext/node/polyfills/_util/std_asserts.ts b/ext/node/polyfills/_util/std_asserts.ts index 7623741379..7e278eb767 100644 --- a/ext/node/polyfills/_util/std_asserts.ts +++ b/ext/node/polyfills/_util/std_asserts.ts @@ -103,7 +103,7 @@ export function equal(c: unknown, d: unknown): boolean { return aTime === bTime; } if (typeof a === "number" && typeof b === "number") { - return NumberIsNaN(a) && NumberIsNaN(b) || a === b; + return ObjectIs(a, b); } if (ObjectIs(a, b)) { return true; diff --git a/tests/unit_node/assert_test.ts b/tests/unit_node/assert_test.ts index f6dc18836d..0b7425003f 100644 --- a/tests/unit_node/assert_test.ts +++ b/tests/unit_node/assert_test.ts @@ -16,3 +16,11 @@ Deno.test("[node/assert] .throws() compares Error instance", () => { TypeError, ); }); + +Deno.test("[node/assert] deepStrictEqual(0, -0)", () => { + assert.throws( + () => { + assert.deepStrictEqual(0, -0); + }, + ); +});