mjackson/expect

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

Open

#230 opened on 2017年9月9日

GitHub で見る
 (4 comments) (0 reactions) (0 assignees)JavaScript (132 forks)batch import
documentationhelp wanted

Repository metrics

Stars
 (2,290 stars)
PR merge metrics
 (30d に merged PR はありません)

説明

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?

コントリビューターガイド