You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
When assert.equal fails, I would expect to get an AssertionError. Instead, when one of the first two arguments has a circular reference in it, I get a TypeError. Here is a contrived example from a node#v0.10.33 repl:
> x = {}
{}
> x.x = x
{ x: [Circular] }
> assert.equal(x, {})
TypeError: Converting circular structure to JSON
at Object.stringify (native)
at getMessage (assert.js:75:24)
at new AssertionError (assert.js:45:37)
at fail (assert.js:92:9)
at Function.equal (assert.js:121:27)
at repl:1:9
at REPLServer.self.eval (repl.js:110:21)
at Interface.<anonymous> (repl.js:239:12)
at Interface.emit (events.js:95:17)
at Interface._onLine (readline.js:202:10)
Clearly this is happening because JSON.stringify fails on x with its circular references. Maybe something like util.inspect can be used instead, in order to replace circular references with [Circular]?
I've tested the following on both 0.10.33 and 0.11.14 and they all behave similarly for the x defined above.
When
assert.equalfails, I would expect to get anAssertionError. Instead, when one of the first two arguments has a circular reference in it, I get aTypeError. Here is a contrived example from a node#v0.10.33 repl:Clearly this is happening because
JSON.stringifyfails onxwith its circular references. Maybe something likeutil.inspectcan be used instead, in order to replace circular references with[Circular]?I've tested the following on both 0.10.33 and 0.11.14 and they all behave similarly for the
xdefined above.