-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
Is it possible to limit the deep equality comparison to a certain depth?
For example:
const a = {
foo: {
bar: {
baz: "qux"
}
}
}
const b = {
foo: { // compared deeply
bar: { // compared by identity (===)
baz: "qux"
}
}
}
// this passes, since 'a' and 'b' are structurally equal
expect(a).to.deep.equal(b);
// this would fail, since the 'bar' object would be compared by identity
expect(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.
Metadata
Metadata
Assignees
Labels
No labels