jest icon indicating copy to clipboard operation
jest copied to clipboard

Add ability to compare "deep" with precision

Open jakeleventhal opened this issue 5 years ago • 3 comments
trafficstars

🚀 Feature Proposal

Add the ability to compare two objects with a precision check. https://github.com/maasencioh/jest-matcher-deep-close-to This extension does the job but lacks a lot of the visibility that jest has when showing diffs. It would also just be cleaner if jest had this built in since this is a conceivably common issue.

Motivation

Often times one will need to compare two objects that contain data. Because of floating point imprecision in Node.js, numbers don't always add up exactly as you expect them to (with ~e-13 points of precision difference). Tests will sometimes need to compare objects for equality but allow for some margin of error.

Example

https://github.com/maasencioh/jest-matcher-deep-close-to does a good job showing this in the README

jakeleventhal avatar May 23 '20 18:05 jakeleventhal

Bump on this, this would be huge

jakeleventhal avatar Sep 14 '21 13:09 jakeleventhal

This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Sep 14 '22 13:09 github-actions[bot]

bump

jakeleventhal avatar Sep 14 '22 14:09 jakeleventhal

This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Sep 14 '23 15:09 github-actions[bot]

bump

jakeleventhal avatar Sep 14 '23 15:09 jakeleventhal

Bump on this

jakeleventhal avatar Dec 22 '23 13:12 jakeleventhal