## TL;DR

Obsolete snapshots are snapshots no test uses anymore. Remove them with `jest --ci=false -u` after verifying they are truly obsolete, and review the diff before committing.

## Error

```text
Snapshot summary: 12 obsolete snapshots found, 0 written, 0 updated.
```

## Steps

1. Run the full suite to see which snapshots are obsolete. Expected: the summary lists them.
2. Check that the tests which used them were intentionally deleted or changed. Expected: no surprise deletions.
3. Remove with `npx jest -u`. Expected: obsolete snapshots are deleted, live ones updated only if changed.
4. Review the snapshot diff in git. Expected: only obsolete entries removed.
5. Commit the cleaned snapshot file. Expected: the suite is green and the file is smaller.

## When to use

- `obsolete` in the snapshot summary after a refactor.
- Snapshot files growing without bound.

## When not to use

- Snapshots mismatch on values (decide update vs app fix first).
- You want to delete snapshots to make failures go away (that deletes coverage).

## Tool compatibility

- Jest 27 through 30; `-u` / `--updateSnapshot`.

## Variant phrasings

### Jest remove unused snapshots

The same task; `-u` is the mechanism.

### Snapshot obsolete after component refactor

The common trigger; verify intent before deleting.

## Why it happens

Snapshots persist in the file even after their test is deleted or renamed. They accumulate silently.

## Edge cases

- `--ci` mode fails on obsolete snapshots instead of cleaning; run cleanup locally, not in CI.
- Renamed tests orphan their snapshots; the summary flags them as obsolete.
- Review the diff: `-u` also updates changed snapshots, which may mask real changes.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_FurNNzJ5ESuOzWJlgwgNKg
