From db2e093e055c9e359745fdf0f2eaf35858455185 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Sat, 19 Aug 2017 02:06:27 -0300 Subject: [PATCH] assert: handle enumerable symbol keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/15169 Reviewed-By: Anna Henningsen Reviewed-By: Refael Ackermann Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott Reviewed-By: James M Snell Reviewed-By: Tobias Nießen --- 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