## TL;DR

Run Jest with --ci on CI, which makes new or changed snapshots fail instead of being written. Check the CI script itself; a config file alone does not enable it, and a stray -u flag overrides it.

## The query

```text
jest snapshot written on CI: how to fail instead of update
```

## Use this when

- CI writes snapshots instead of failing
- snapshot changes slip through green builds
- new snapshots appear in CI artifacts

## Not for

- updating snapshots locally
- obsolete-snapshot cleanup
- snapshot serializers

## Steps

1. Open the CI script and confirm the test command includes --ci. Expected output: the jest command line contains the --ci flag.
2. Search the same command for -u or --updateSnapshot and remove it. Expected output: no snapshot-update flags in the CI command.
3. Commit the current snapshots so CI compares against a known baseline. Expected output: snapshot files committed and clean in git status.
4. Push a branch that changes snapshotted output and confirm CI fails on the snapshot mismatch. Expected output: a red CI run naming the changed snapshot.
5. Keep local runs without --ci so developers can still update snapshots intentionally with -u. Expected output: local -u updates snapshots while CI --ci fails on them.

## Provenance

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