Updating snapshots
editWhen a snapshot does not match, the test fails, the new content is written to an .actual file next to the verified file, and the failure message lists the files that changed, appeared or disappeared. Review the difference, then either fix the code or approve the new snapshot. There are three ways to approve:
- Approve the actual files after the run, with the approval tool or by renaming the files yourself. Nothing changes until you decide. See The approval tool.
- Let the test run overwrite the verified files, with the Overwrite or OverwriteWithoutFailure update strategy, and review the result in your version control diff. See Update strategies.
- Merge each change in a merge tool that the test run opens, with the MergeTool or MergeToolSync strategy. See Merge tools.
The default strategy, Disallow, never changes a verified file: you approve with the tool. Whatever the strategy, snapshots are never updated on a build server, in a continuous testing runner or when the tests are run by an LLM agent. See Continuous integration.
- Update strategies: what happens when a snapshot does not match, and how to choose a strategy for a run.
- The approval tool: approve every actual file, or one by one, from the command line.
- Merge tools: which tool is started, and how to choose it.
- Continuous integration: the environments where snapshots are never updated.