From ddf110f29beff6376993e1c0793b0b2feba92297 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Sat, 19 Aug 2017 02:06:27 -0300 Subject: [PATCH] assert: handle enum. symbol keys in deepStrictEqual --- doc/api/assert.md | 25 +++-- lib/assert.js | 125 ++++++++++++++--------- test/parallel/test-assert-deep.js | 28 +++++ test/parallel/test-net-normalize-args.js | 11 +- 4 files changed, 127 insertions(+), 62 deletions(-) diff --git a/doc/api/assert.md b/doc/api/assert.md index ca7f048f9e04f1..a3cb02c7bca625 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -46,12 +46,11 @@ Primitive values are compared with the [Abstract Equality Comparison][] Only [enumerable "own" properties][] are considered. The [`assert.deepEqual()`][] implementation does not test the -[`[[Prototype]]`][prototype-spec] of objects, attached symbols, or -non-enumerable properties — for such checks, consider using -[`assert.deepStrictEqual()`][] instead. This can lead to some -potentially surprising results. For example, the following example does not -throw an `AssertionError` because the properties on the [`RegExp`][] object are -not enumerable: +[`[[Prototype]]`][prototype-spec] of objects or enumerable own [`Symbol`][] +properties. For such checks, consider using [assert.deepStrictEqual()][] +instead. [`assert.deepEqual()`][] can have potentially surprising results. The +following example does not throw an `AssertionError` because the properties on +the [RegExp][] object are not enumerable: ```js // WARNING: This does not throw an AssertionError! @@ -109,6 +108,9 @@ parameter is an instance of an `Error` then it will be thrown instead of the