Comparison between uninitialized arrays fail
Open
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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