joist-orm / joist-orm/joist-orm

Investigate Jest's new custom equality matchers

Open
#491 0 comments 0 reactions 0 assignees View on GitHub
good first issue hack day
Dominant language
TypeScript
Stars
385
Forks
26
Avg merge
8h 55m
Merged PRs (30d)
42

Description

Historically Jest's `toEqual` has caused us grief b/c of recursively diffing entities down to the connection pool, which can end up pegging a CPU for ~several seconds even on a passing assertion.

We've written `toMatchEntity` to avoid this, but it requires teaching programmers when to use it.

Jest just landed custom equality matchers:

https://github.com/facebook/jest/pull/13654

So we can see if that helps. My suspicion is that `toMatchEntity`'s diff output will still be easier to read, so it probably won't completely go away, but if we can de-suck `toEqual`, that would be great too.

Contributor guide

Open the contributing guide

Research direction

Start by reading the linked Jest custom equality matchers proposal and tracing the existing toMatchEntity implementation and its uses. Compare whether the matcher can prevent toEqual from recursively traversing entities while preserving readable diffs; done means a documented recommendation or a concrete follow-up scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.