-
Notifications
You must be signed in to change notification settings - Fork 16
Closed
Labels
Milestone
Description
Right now, the .to.equal
assertion after having chai-immutable
in chai
does "deep" comparison. It compares the keys and values of Maps, values of Lists and so on. This breaks the original behaviour of .to.equal
in chai
.
I understand that it is done on purpose, and test code often needs this more than reference comparison. However, when having chai-immutable
in our specs, we can't compare references, only via expect(a === b).to.be.true
which is not a good practice in "having readable assertions". There is even an eslint plugin for it.
It would be cool to:
- either change the
chai-immutable
'sequal
toeql
ordeep.equal
and keepequal
for comparing references (this will break backward compatibility here, but will unify the behaviour with the rest ofchai
) - or add a new method for comparing references, e.g.
.to.referenceEqual
Would you be open to a PR for any of these? Or is there any other problem or issue regarding this?