--force-update-snapshots writes a snapshot when the contents don't match exactly — for example the reference snapshot has a legacy format or slightly incorrect metadata. Despite its name, it doesn't write snapshots that do match exactly.
I've done a lot of work on improving many edge cases there. But I think that may have been a fool's errand, and we should instead just write every snapshot when --force-update-snapshots is passed.
In particular, insta can't capture the surrounding delimiters of inline snapshots (because we don't want to add a serde dependency to insta, only to cargo-insta), so we can't identify whether we need to update the snapshot for that reason. In that case, there's currently no way to update snapshots except for manually breaking them and rerunning cargo insta test --accept.
So I would propose that the behavior should be:
--force-update-snapshots writes every snapshot, whether or not it perceives it's required
Potentially it implies --accept to reduce the noise of new files
--require-full-match takes most of the existing function of --force-update-snapshots — i.e. comparing the exact snapshot, as much as insta can perceive, while ignoring any snapshots that it perceives as identical.
Unlike --force-update-snapshots, it'll also fail on any discrepancies, but I don't think that's necessarily bad
--force-update-snapshots
writes a snapshot when the contents don't match exactly — for example the reference snapshot has a legacy format or slightly incorrect metadata. Despite its name, it doesn't write snapshots that do match exactly.I've done a lot of work on improving many edge cases there. But I think that may have been a fool's errand, and we should instead just write every snapshot when
--force-update-snapshots
is passed.In particular,
insta
can't capture the surrounding delimiters of inline snapshots (because we don't want to add aserde
dependency toinsta
, only tocargo-insta
), so we can't identify whether we need to update the snapshot for that reason. In that case, there's currently no way to update snapshots except for manually breaking them and rerunningcargo insta test --accept
.So I would propose that the behavior should be:
--force-update-snapshots
writes every snapshot, whether or not it perceives it's required--accept
to reduce the noise of new files--require-full-match
takes most of the existing function of--force-update-snapshots
— i.e. comparing the exact snapshot, as much asinsta
can perceive, while ignoring any snapshots that it perceives as identical.--force-update-snapshots
, it'll also fail on any discrepancies, but I don't think that's necessarily bad