Skip to content

[Feature]: make toMatchAriaSnapshot "partial" behavior optional or add "toMatchFullAriaSnapshot" #35158

@lukpsaxo

Description

@lukpsaxo

🚀 Feature Request

I've been using toMatchAriaSnapshot and its great, thanks!

But one frustration is that as I am building I frequently 1) add a new component 2) run the tests - they pass 3) notice the new component is missing from the snapshot 4) run with --update-snapshots but nothing is generated 5) delete the snapshot completely 6) run again with --update-snapshots 7) apply the patch - and now I have the item in my snapshot.

Example

I'd love a option - isPartialMatch: false or a new matcher toMatchFullAriaSnapshot that error'd if something new appears and when I run with update snapshot, it adds any new items.

Motivation

Personally I am often trying to test for correctness as a priority, so I would rather be explicit and either 1) its hand-crafted and partial matched or 2) its generated by playwright and updated in full.

I didn't expect partial matching to be the default, when I am mostly generating the snapshots automatically. I expect many people use the feature and just don't realize that new components have been added and a test is not updated.

I believe in my place of work that people will add new features and forget to capture those within existing (or new) snapshots - they will just see existing tests pass and not look at them. Then over time the existing snapshots may start to differ from reality.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions