Skip to content

Conversation

@gkampitakis
Copy link
Owner

@gkampitakis gkampitakis commented Jul 8, 2023

The api right now looks like

Calling the first time

t.Run("my test", func(t *testing.T) {
user := struct{ Name string }{
	Name: "george",
}

snaps.MatchInlineSnapshot(t, user, nil)
})

and then it will populate with the snapshot data

t.Run("my test", func(t *testing.T) {
user := struct{ Name string }{
	Name: "george",
}

snaps.MatchInlineSnapshot(t, user, snaps.Inline("struct { Name string }{Name:\"george\"}"))
})

Still haven't investigated all the edge cases that this can have and I can see being useful but not sure how much is it worth it.

Two issues that are not addressed

  • Long line snapshots, haven't found a way to split text to multiples lines
    - I believe jest doesn't address it at all. I want to also have a look how it's handled by insta.
  • Comments ast parsing.
    - I have seen some weird behaviours, but nothing major. I want to test further.
  • Currently there is an issue with the current approach. If a file has multiple InlineSnapshots and updated at the same time the file lines can be moved breaking the "write". I am investigating ways to fix this.
  • I want to run tests to make concurrent (t.Parallel) safe.

closes #110

@gkampitakis gkampitakis force-pushed the inlinesnapshot branch 6 times, most recently from e016ff1 to 0a6c930 Compare July 9, 2023 19:26
@gkampitakis gkampitakis closed this Feb 3, 2024
@gkampitakis gkampitakis reopened this Oct 30, 2024
@gkampitakis gkampitakis force-pushed the inlinesnapshot branch 2 times, most recently from 36fa535 to 10cd7a8 Compare November 2, 2025 11:16
@gkampitakis gkampitakis force-pushed the inlinesnapshot branch 3 times, most recently from bca276e to 4d50e5d Compare November 22, 2025 16:59
@gkampitakis gkampitakis marked this pull request as ready for review November 22, 2025 17:14
@gkampitakis gkampitakis enabled auto-merge (squash) November 22, 2025 17:16
@gkampitakis gkampitakis disabled auto-merge November 22, 2025 17:16
@gkampitakis gkampitakis merged commit a635213 into main Nov 22, 2025
7 checks passed
@gkampitakis gkampitakis deleted the inlinesnapshot branch November 22, 2025 17:16
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.

[Feature Request]: auto-updated inline snaps

2 participants