Updating & File Snapshots in Vitest
From the Vitest cheat sheet · Snapshots · verified Nov 2026
Updating & File Snapshots
Update or review snapshots, snapshot to real files, and add serializers
typescript
// vitest -u update failing snapshots
// watch mode: u = update all, i = review one by one (5.1+)
await expect(html).toMatchFileSnapshot('./__fixtures__/card.html')⚡ Press i in watch mode (5.1+) to accept or reject each change
📌 v5: toMatchFileSnapshot must be awaited or the test fails
⚠️ CI never writes snapshots; run vitest -u locally and commit
💡 Use a separate folder for file snapshots, not __snapshots__
snapshotupdatetoMatchFileSnapshotserializer
Continue with Vitest
Save the full cheat sheet or work through every related task.