mjackson/expect
View on GitHubDocument that the jest code mods won't cover all cases?
Open
#230 opened on Sep 9, 2017
documentationhelp wanted
Description
I'm trying out migrating from mocha & expect to just jest.
The code mods handled most of the cases, but there are some MAJOR differences in how Jest's isEqual matcher works, mostly because it does not use the is-equal package anymore.
This means things like this worked with expect but DO NOT work with jest:
expect(["abc"]).toEqual("abc");
function createEnhancedFunction() {
var myFunction = function() { return "a value"; };
myFunction.a = "123";
return myFunction;
}
expect({ a: createEnhancedFunction() }).toEqual({ a: createEnhancedFunction() });
The first difference is easy to work around, but the second one (inability to compare functions and treat them as equal) has me a little stumped.
I'd think it would be good to emphasize that is-equal is no longer used for equality checks, and maybe suggest some workarounds in the docs?