## TL;DR
Run jest locally with `-u` against the failing spec to remove the obsolete snapshot, check the `.snap` diff with git to confirm only the stale entry was dropped, commit the change, and rerun with `--ci`. The `--ci` flag turns obsolete snapshots into hard failures, so a suite that looks green on your machine can fail in the pipeline. Once you know which snapshot file is stale, the fix takes about five minutes.

```text
jest "Snapshot summary: 1 snapshot obsolete" failing CI with --ci flag: how to clean up
```

## Steps
1. Find which snapshot file is stale. Run the failing spec locally with the flag: `npx jest path/to/spec --ci`. Read the summary line that names the `.snap` file and the obsolete entry. Expected: you know exactly which snapshot file holds the stale entry.
2. Confirm the snapshot is truly obsolete. Open the `.snap` file and check that the test or component it captured no longer exists in the codebase. Expected: the entry maps to deleted code, not to a live test.
3. Clear it with an update run scoped to that spec: `npx jest path/to/spec -u`. Expected: the output reports the obsolete snapshot removed and the spec passes.
4. Review the diff on the `.snap` file before committing: `git diff path/to/spec/__snapshots__/`. Expected: only the obsolete entry was removed, no other snapshots changed.
5. Commit the updated `.snap` file and rerun the full suite with `--ci`. Expected: the summary shows 0 obsolete snapshots and CI passes.

## Use this when
- CI runs jest with `--ci` and fails on obsolete snapshots
- The suite passes locally but the pipeline reports "1 snapshot obsolete"
- A test or component was deleted and its snapshot entry was never cleaned up

## Not for this skill when
- The snapshot VALUE changed (a mismatch), not an obsolete entry
- A brand-new test fails because its snapshot was never written
- The failure is not snapshot-related at all (timeouts, imports, test logic)

## Variant phrasings
- jest snapshot obsolete is failing the build in CI
- the --ci flag turns obsolete snapshots into failures
- clean up stale snapshots so jest --ci passes

## Why it happens
Local runs tolerate obsolete snapshots silently and never flag them. The `--ci` flag exists to make CI strict: it refuses to write anything and fails the run on both new and obsolete snapshots. Deleting a test leaves its snapshot entry behind, invisible locally, until `--ci` flags it in the pipeline.

## Edge cases
- If `-u` removed more than the one obsolete entry, the extra removals were also stale entries, but review each one before committing.
- Inline snapshots (toMatchInlineSnapshot) can go obsolete too; `-u` cleans those inside the spec file itself.
- If the snapshot is not actually obsolete (the test still exists), do not use `-u`. You have a value mismatch, which is a different problem.

## Provenance

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