Skip to content

Add --update (-u) flag to auto-accept snapshot changes#52

Open
georgephillips wants to merge 1 commit intomainfrom
snapshot-force-option
Open

Add --update (-u) flag to auto-accept snapshot changes#52
georgephillips wants to merge 1 commit intomainfrom
snapshot-force-option

Conversation

@georgephillips
Copy link
Copy Markdown
Contributor

  • Adds a -u / --update CLI flag (and TOOLPROOF_UPDATE env var) that automatically accepts all snapshot changes without interactive prompts, writing updated YAML files to disk inline during the test run.
  • Updates the non-interactive hint message to mention --update (-u) alongside -i.
  • Adds a new test (snapshot_update.toolproof.yml) that verifies the flag auto-updates a mismatched snapshot on disk and reports the test as passing.

Motivation

When snapshots change, toolproof currently requires either interactive terminal review (-i) or fails the run. This makes it unusable for AI coding agents and headless CI that want to update snapshots in place. The --update / -u naming follows the established convention from Jest (--updateSnapshot / -u), Vitest (--update / -u), and pytest (--snapshot-update).

Adds a new CLI flag matching the convention used by Jest, Vitest, and
pytest snapshot tooling. When passed, changed snapshots are written to
disk automatically without interactive review, and the test run reports
them as passing. This makes toolproof usable in headless CI and AI
runner environments where no TTY is available for interactive approval.
@georgephillips georgephillips requested a review from bglw as a code owner April 8, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants