Automattic / Automattic/expect.js

Provide method for deep equivalence with type saftey.

Open
#51 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.1k
Forks
207
PR merge metrics
No merged PRs in 30d

Description

Currently you can do `is` but that will ensure two objects are equal. It would be nice to have a way to ensure all values are equal and the correct type.

```
expect({a:5}).to.eql({a:"5"}); // Passes.
```

It would be nice to have this as I have objects with many properties and it is a pain to manually `.is()` check each property.

So it would be nice to have something that strictly compares types if "scalar" values (including strings). And recursively compares objects and Arrays.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the existing `is` and `eql` assertion behavior, using the object example in the issue to reproduce the current result. The change is done when a deep comparison rejects scalar values with different types while recursively comparing nested objects and arrays.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.