mjackson / mjackson/expect

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

Open
#230 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation help wanted
Dominant language
JavaScript
Stars
2.3k
Forks
115
PR merge metrics
No merged PRs in 30d

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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the migration and code-mod documentation for the Mocha/expect-to-Jest transition. Document that equality behavior differs because is-equal is no longer used, include the reported examples, and explain any supported workarounds.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.