Skip to content

Document that the jest code mods won't cover all cases? #230

@jharris4

Description

@jharris4

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?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions