Add guidelines about when and how to use snapshot tests effectively

Open Beginner friendly
#115 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

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.

Description

category-documentation github-migration-triaged team-wallet-framework wf-documentation

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:

Dominant language
JavaScript
Stars
86
Forks
42
PR merge metrics
No merged PRs in 30d

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.

More from MetaMask/contributor-docs

All issues in MetaMask/contributor-docs

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.