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
Is it possible to limit the deep equality comparison to a certain depth?
For example:
consta={foo: {bar: {baz: "qux"}}}constb={foo: {// compared deeplybar: {// compared by identity (===)baz: "qux"}}}// this passes, since 'a' and 'b' are structurally equalexpect(a).to.deep.equal(b);// this would fail, since the 'bar' object would be compared by identityexpect(a).to.deep.depth(1).equal(b);
In my real-world scenario the bar object would of course be a lot more complicated. Comparing these by identity is more than sufficient, and deep-equality even runs into issues due to circular references.
The text was updated successfully, but these errors were encountered:
Is it possible to limit the deep equality comparison to a certain depth?
For example:
In my real-world scenario the
bar
object would of course be a lot more complicated. Comparing these by identity is more than sufficient, and deep-equality even runs into issues due to circular references.The text was updated successfully, but these errors were encountered: