Skip to content

Snapshots

Catch every change to a response.

The first run saves the response to a snapshot file next to your tests; every later run compares against it. Review intentional changes, update the snapshot and commit it with your code.

me.yaml
# curl-runner me.yaml --snapshot --ci-snapshot
global:
  snapshot:
    dir: __snapshots__
    updateMode: failing

requests:
  - name: Get profile
    url: https://api.example.com/me
    snapshot: true

Benefits

  • No expectations to write

    The whole response body becomes the assertion. Any field that changes shows up as a diff.

  • Deliberate updates

    Use -u to update every snapshot, or --update-failing to refresh only the ones that changed.

  • Strict in CI

    --ci-snapshot fails the run when a snapshot is missing instead of quietly writing a new one.

Good for

  1. Large responses that are tedious to assert field by field
  2. Locking down a public API’s shape
  3. Refactors that must not change output
  4. Reviewing response changes in code review