MetaMask / MetaMask/contributor-docs

Add guidelines about when and how to use snapshot tests effectively

Open Beginner friendly
#115 1 comment 0 reactions 0 assignees View on GitHub
category-documentation github-migration-triaged team-wallet-framework wf-documentation
Dominant language
JavaScript
Stars
86
Forks
42
PR merge metrics
No merged PRs in 30d

Description

Snapshot tests are often "misused" to create hard-to-understand and brittle tests that are not effective at catching bugs. They can be useful in narrow situations though.

We should write guidance about when and how to effectively use snapshot tests.

There is some mention of snapshot testing here already: https://github.com/MetaMask/contributor-docs/blob/main/docs/testing/unit-testing.md#snapshots
But it doesn't provide enough guidance yet.

References for inspiration:
* https://x.com/searls/status/919594505938112512
* https://www.youtube.com/watch?v=Af4M8GMoxi4

Contributor guide

Open the contributing guide

Research direction

Start with docs/testing/unit-testing.md and its existing Snapshots section. Review the linked references for useful principles, then expand the documentation with guidance on when snapshots are appropriate and how to keep them understandable and effective. Done means the section clearly addresses both appropriate use and common misuse.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation, testing
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.