node/doc/api
Joseph Gentle 6481c93aef
assert: add support for Map and Set in deepEqual
assert.deepEqual and assert.deepStrictEqual currently return true for
any pair of Maps and Sets regardless of content. This patch adds
support in deepEqual and deepStrictEqual to verify the contents of Maps
and Sets.

Deeo equivalence checking is currently an
O(n^2) operation, and worse, it gets slower exponentially if maps
and sets were nested.

Note that this change breaks compatibility with previous versions of
deepEqual and deepStrictEqual if consumers were depending on all maps
and sets to be seen as equivalent. The old behaviour was never
documented, but nevertheless there are certainly some tests out there
which depend on it.

Support has stalled because the assert API was frozen, but was recently
unfrozen in CTC#63.

---

Later squashed in:

This change updates the checks for deep equality checking on Map and Set
to check all set values / all map keys to see if any of them match the
expected result.

This change is much slower, but based on the conversation in the pull
request its probably the right approach.

Fixes: https://github.com/nodejs/node/issues/2309
Refs: https://github.com/substack/tape/issues/342
Refs: https://github.com/nodejs/node/pull/2315
Refs: https://github.com/nodejs/CTC/issues/63
PR-URL: https://github.com/nodejs/node/pull/12142
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2017-04-03 10:15:53 +02:00
..
_toc.md doc: synchronize + update _toc.md and all.md 2017-02-14 19:07:02 -05:00
addons.md doc: update link to V8 Embedder's guide 2017-02-14 11:15:57 +01:00
all.md doc: synchronize + update _toc.md and all.md 2017-02-14 19:07:02 -05:00
assert.md assert: add support for Map and Set in deepEqual 2017-04-03 10:15:53 +02:00
buffer.md doc: clarify out-of-bounds behavior of buf[index] 2017-03-28 11:25:55 +03:00
child_process.md doc: correct info in child_process.md 2017-03-22 09:16:02 -07:00
cli.md tty: remove NODE_TTY_UNSAFE_ASYNC 2017-03-31 22:02:25 +02:00
cluster.md doc/tools: fix more type inconsistencies 2017-03-08 17:19:24 +01:00
console.md doc/tools: fix more type inconsistencies 2017-03-08 17:19:24 +01:00
crypto.md crypto: add sign/verify support for RSASSA-PSS 2017-04-01 13:27:52 +02:00
debugger.md doc: update V8 debugger doc to mention --inspect-brk 2017-02-27 13:58:18 -08:00
deprecations.md doc: deprecate private http properties 2017-03-09 05:50:18 -05:00
dgram.md dgram: support Uint8Array input to send() 2017-03-27 02:03:51 +02:00
dns.md doc: argument types for dns methods 2017-03-14 17:29:52 -07:00
documentation.md doc: remove Locked from stability index 2017-03-05 19:43:05 -08:00
domain.md doc: fix sorting in API references 2017-02-20 13:11:11 -08:00
errors.md doc/tools: fix more type inconsistencies 2017-03-08 17:19:24 +01:00
events.md events, doc: check input in defaultMaxListeners 2017-03-22 13:59:45 -07:00
fs.md doc: update and modernize examples in fs.ms 2017-03-27 10:33:23 -07:00
globals.md doc/tools: fix more type inconsistencies 2017-03-08 17:19:24 +01:00
http.md doc: fix http properties documented as methods 2017-03-27 10:30:50 -07:00
https.md doc: fix https.timeout docs 2017-03-27 10:31:43 -07:00
index.md doc: git mv to .md 2016-04-20 16:34:27 -07:00
modules.md doc: require uses fs root for '/' prefix 2017-03-21 23:06:52 -07:00
net.md doc: fix stylistic issues in api/net.md 2017-03-15 01:10:12 +08:00
os.md doc/tools: fix more type inconsistencies 2017-03-08 17:19:24 +01:00
path.md doc/tools: fix more type inconsistencies 2017-03-08 17:19:24 +01:00
process.md doc: stdout/err/in are all Duplex streams 2017-03-27 11:43:07 +02:00
punycode.md doc: consistent case for primitive types 2017-03-02 17:55:45 +01:00
querystring.md doc: consistent case for primitive types 2017-03-02 17:55:45 +01:00
readline.md readline: rename deDupeHistory option 2017-03-22 08:56:24 -07:00
repl.md doc/tools: fix more type inconsistencies 2017-03-08 17:19:24 +01:00
stream.md doc: add missing word in stream.md 2017-03-20 12:14:33 -07:00
string_decoder.md doc: document pending semver-major API changes 2017-02-24 02:06:31 +01:00
synopsis.md doc: various documentation formatting fixes 2016-07-14 12:26:50 +03:00
timers.md doc: fix broken URL to event loop guide 2017-03-06 16:01:26 +01:00
tls.md tls: support Uint8Arrays for protocol list buffers 2017-03-27 02:08:49 +02:00
tracing.md src: Node Tracing Controller 2016-12-20 12:31:09 -08:00
tty.md doc: add some info on tty#setRawMode() 2016-12-08 13:39:45 -05:00
url.md doc/tools: fix more type inconsistencies 2017-03-08 17:19:24 +01:00
util.md util: add %i and %f formatting specifiers 2017-03-29 07:12:05 +02:00
v8.md v8: expose new V8 serialization API 2017-03-29 05:14:55 +02:00
vm.md doc: add note that vm module is not a security mechanism 2017-03-17 11:19:13 -07:00
zlib.md zlib: support Uint8Array in convenience methods 2017-04-03 09:50:09 +02:00