Commit 6b87906
authored
test: update unit test guidelines to account for the removal of toMatchSnapshot (#28499)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
> Adds a **mandatory snapshot testing policy** that bans
`toMatchSnapshot()` (and new `.snap` files) and explicitly allows
`toMatchInlineSnapshot()` only when the serialized output is the real
assertion.
>
> Updates reviewer/author workflow guidance to *flag and migrate*
existing `toMatchSnapshot()` usages when touching tests, and extends the
unit test runner instructions to detect and report banned snapshot
calls.
>
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry:
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: my feature name
Scenario: user [verb for user action]
Given [describe expected initial app state]
When user [verb for user action]
Then [describe expected outcome]
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I've included tests if applicable
- [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Low risk because changes are documentation-only, affecting developer
workflow/review expectations but not runtime code. The main risk is
process friction if teams rely on external `.snap` snapshots.
>
> **Overview**
> Adds a **mandatory snapshot testing policy** that bans
`toMatchSnapshot()` (and new `.snap` files) and explicitly allows
`toMatchInlineSnapshot()` only when the serialized output is the real
assertion.
>
> Updates reviewer/author workflow guidance to *flag and migrate*
existing `toMatchSnapshot()` usages when touching tests, and extends the
unit test runner instructions to detect and report banned snapshot
calls.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
407c55d. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 0a229a8 commit 6b87906
2 files changed
Lines changed: 70 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | | - | |
15 | 13 | | |
16 | 14 | | |
17 | 15 | | |
18 | 16 | | |
| 17 | + | |
19 | 18 | | |
20 | 19 | | |
21 | | - | |
22 | 20 | | |
23 | 21 | | |
24 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
176 | 232 | | |
177 | 233 | | |
178 | 234 | | |
| |||
398 | 454 | | |
399 | 455 | | |
400 | 456 | | |
401 | | - | |
| 457 | + | |
402 | 458 | | |
403 | 459 | | |
404 | 460 | | |
| |||
514 | 570 | | |
515 | 571 | | |
516 | 572 | | |
517 | | - | |
| 573 | + | |
518 | 574 | | |
519 | 575 | | |
520 | 576 | | |
| |||
527 | 583 | | |
528 | 584 | | |
529 | 585 | | |
| 586 | + | |
530 | 587 | | |
531 | 588 | | |
532 | 589 | | |
| |||
545 | 602 | | |
546 | 603 | | |
547 | 604 | | |
| 605 | + | |
548 | 606 | | |
549 | 607 | | |
550 | 608 | | |
| |||
588 | 646 | | |
589 | 647 | | |
590 | 648 | | |
591 | | - | |
592 | | - | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
593 | 652 | | |
594 | 653 | | |
595 | 654 | | |
| |||
606 | 665 | | |
607 | 666 | | |
608 | 667 | | |
609 | | - | |
| 668 | + | |
610 | 669 | | |
611 | 670 | | |
| 671 | + | |
| 672 | + | |
612 | 673 | | |
613 | 674 | | |
614 | | - | |
| 675 | + | |
615 | 676 | | |
616 | 677 | | |
617 | 678 | | |
| |||
640 | 701 | | |
641 | 702 | | |
642 | 703 | | |
643 | | - | |
| 704 | + | |
644 | 705 | | |
645 | 706 | | |
646 | 707 | | |
| |||
652 | 713 | | |
653 | 714 | | |
654 | 715 | | |
655 | | - | |
| 716 | + | |
656 | 717 | | |
657 | 718 | | |
0 commit comments