Repository navigation
Add matcher for object arrays - #40
patrickschilder wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new object-array matcher, toContainObjectMatching, to the Playwright Expectly matcher suite, along with documentation and tests to validate partial-object containment semantics and the allowMultiple option.
Changes:
- Introduces
toContainObjectMatchingmatcher implementation for object arrays (supports partial matches viaexpect.objectContainingand anallowMultipleoption). - Adds comprehensive test coverage for matching, negation, and typed-array usage.
- Updates public matcher typings, docs, and versioning artifacts (changeset + lockfile/package updates).
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/playwright-expectly/tests/expectly-object-array.spec.ts | Adds new test suites covering toContainObjectMatching, including typed-object scenarios. |
| packages/playwright-expectly/src/types/matcher-types.ts | Exposes the new matcher in the global matcher type definitions. |
| packages/playwright-expectly/src/expectly-object-array.ts | Implements the toContainObjectMatching matcher in the object-array matcher set. |
| docs/OBJECT_ARRAY_MATCHERS.md | Documents toContainObjectMatching usage and the allowMultiple option. |
| .changeset/clever-beds-brush.md | Declares a minor release for the new matcher. |
| package.json | Adds an allowScripts entry. |
| package-lock.json | Updates workspace package versions and removes extraneous entries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "engines": { | ||
| "node": "^22.18.0 || >=24.11.0" | ||
| }, | ||
| "allowScripts": { |
There was a problem hiding this comment.
This is required for new node versions and using packages which need to run scripts. Otherwise npm install will fail
| const assertionName = "toContainObjectMatching"; | ||
| const allowMultiple = options?.allowMultiple ?? true; | ||
|
|
||
| const expectedMatcher = baseExpect.objectContaining(expected); |
There was a problem hiding this comment.
What about an object with nested objects/arrays?
There was a problem hiding this comment.
Now we only allow plain objects? So toContainPlainObjectMatching? ;)
No description provided.