From 7493db21b667ed746d39c9b54357eac4287232e3 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 13 Dec 2018 07:33:31 +0100 Subject: [PATCH] assert: adjust loose assertions This changes the loose deep equal comparison by using the same logic as done in the strict deep equal comparison besides comparing primitives loosely, not comparing symbol properties and not comparing the prototype. `assert.deepEqual` is still commenly used and this is likely the biggest pitfall. Most changes are only minor and won't have a big impact besides likely fixing user expectations. PR-URL: https://github.com/nodejs/node/pull/25008 Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius --- doc/api/assert.md | 47 ++++-- lib/internal/util/comparisons.js | 153 ++++++------------ test/es-module/test-esm-dynamic-import.js | 9 +- test/parallel/test-assert-checktag.js | 8 +- test/parallel/test-assert-deep.js | 50 +++--- .../test-assert-typedarray-deepequal.js | 10 +- 6 files changed, 116 insertions(+), 161 deletions(-) diff --git a/doc/api/assert.md b/doc/api/assert.md index 4c4b2c4250f581..67bc9afbabccbe 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -163,6 +163,10 @@ An alias of [`assert.ok()`][].