chaijs / chaijs/deep-eql

Comparison between uninitialized arrays fail

Open
#62 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
112
Forks
45
Avg merge
2d 21h
Merged PRs (30d)
1

Description

Performing a deep equal on an uninitialized array doesn't behave as expected.

      const myTestArray1 = [undefined, 'test']
      const myTestArray2 = []
      // myTestArray2[0] should be equal to undefined by default
      myTestArray2[1] = 'test'

      expect(myTestArray1).to.deep.equal(myTestArray2)

I would expect these two arrays to pass a deep equality check since javascript seems to default uninitialized values to undefined

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 reproducing the JavaScript example in this issue and tracing the array comparison path. Add a regression test covering an explicit undefined element versus a sparse array, then confirm the deep-equality result matches the expected behavior described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.