Closed
Description
I've checked with Node.js 0.12.0, and their assert.deepEqual()
is able to compare objects with circular references, without running on forever or hitting stack limits.
var assert = require('assert');
var a = {}, b = {};
a.b = b; b.a = a;
assert.deepEqual(a, b);
// throws assertion
Node.js 0.10.36 throws:
TypeError: Converting circular structure to JSON
This isn't as good as actually performing some comparison, but at least it doesn't loop infinitely or anything.
The same thing in tape v3.5.0 with deep-equal v0.2.2 throws:
RangeError: Maximum call stack size exceeded
This might be more of a tape problem, but it actually throws instead of being caught as a failed assertion.
Would it be possible to at least have this return false
in this sort of case?
Cheers. Love your work. :)
Metadata
Metadata
Assignees
Labels
No labels