vitest-dev / vitest-dev/vitest

Order-sensitive diff on expect.arrayContaining failure

Open
#8,913 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

p2-to-be-discussed pending triage
Dominant language
TypeScript
Stars
17.1k
Forks
2k
Avg merge
1d 22h
Merged PRs (30d)
94

Description

Describe the bug

Diff from failed expect.arrayContaining([...]) assertion is incorrectly order sensitive.

I expect that the diff should be order-agnostic, and correctly identify all matching elements.

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-92aubqtb

Used Package Manager

npm

Validations

Contributor guide

Open the contributing guide

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 running the linked StackBlitz reproduction for the expect.arrayContaining failure and trace the assertion's diff output. The fix is done when the diff is order-agnostic and correctly identifies all matching elements, with the existing reproduction or a corresponding test confirming the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.