Skip to content

Snapshot testing 2.0#2620

Merged
plajjan merged 1 commit into
mainfrom
snapshot-accept
Jan 30, 2026
Merged

Snapshot testing 2.0#2620
plajjan merged 1 commit into
mainfrom
snapshot-accept

Conversation

@plajjan

@plajjan plajjan commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

This changes our golden snapshot testing. First of all is a rename from "golden" to "snapshot". Both are accepted terms in the industry it seems and there is some variance in popularity in different corners but overall it seems that "snapshot testing" is a much much more commonly used term, so we're merely aligning that.

Second, we now always write output from snapshot tests, that is, the output they return is written to disk. This makes it very easy to inspect the result in an editor, to manually run a diff command or similar.

Everything snapshot related is now placed in a snapshot directory at a project root level. snapshots/expected for the expected files (should be checked into git!) and snapshots/output for the output files that are always written (and should not be checked into git).

--accept is now accepted (heh, pun) even for cached result, so despite not running the test, it updates the (cached) output as the new expected value.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 807465f611

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread compiler/acton/TestRunner.hs Outdated
This changes our golden snapshot testing. First of all is a rename from
"golden" to "snapshot". Both are accepted terms in the industry it seems
and there is some variance in popularity in different corners but
overall it seems that "snapshot testing" is a much much more commonly
used term, so we're merely aligning that.

Second, we now always write output from snapshot tests, that is, the
output they return is written to disk. This makes it very easy to
inspect the result in an editor, to manually run a diff command or
similar.

Everything snapshot related is now placed in a snapshot directory at a
project root level. snapshots/expected for the expected files (should be
checked into git!) and snapshots/output for the output files that are
always written (and should not be checked into git).

--accept is now accepted (heh, pun) even for cached result, so despite
not running the test, it updates the (cached) output as the new expected
value.
@plajjan plajjan enabled auto-merge January 30, 2026 16:15
@plajjan plajjan merged commit 365dbf9 into main Jan 30, 2026
35 of 37 checks passed
@plajjan plajjan deleted the snapshot-accept branch January 30, 2026 16:38
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.

1 participant