michelsalib / chai-shallow-deep-equal

Shallow deep equal for chai
20 stars 9 forks source link

Please use === for equality checks #13

Open robaca opened 8 years ago

robaca commented 8 years ago

shallowDeepEqual compares properties using '==', which leads to equality when comparing strings '9' to an equal number 9.

michelsalib commented 8 years ago

Is that ok if we provide a stricShallowDeepEquall the same was as http://chaijs.com/api/assert/#method_strictequal ?

robaca commented 8 years ago

That would be great

robaca commented 8 years ago

The default chai functions equal and deep.equal seem to be strict by default

michelsalib commented 8 years ago

that's not what the documentation says http://chaijs.com/api/assert/#method_equal nor the code https://github.com/chaijs/chai/blob/387dca2320751f3e13474ea12c595b4b6ce59d49/lib/chai/interface/assert.js#L108-L133

robaca commented 8 years ago

ok. That's right for assert, but not for expect: http://chaijs.com/api/bdd/#method_equal

michelsalib commented 8 years ago

wow that is unexpected D:

andreas commented 4 years ago

@michelsalib, would you consider accepting a PR that aligns "equality strictness" of shallowDeepEqual with equal, i.e. when used with assert it's based on ==, while when used with expect it's based on ===.

Examples:

Or perhaps you have other ideas on how to introduce more strictness? Thanks in advance for your help! :pray: