gkampitakis / go-snaps

Jest-like snapshot testing in Go 📸
https://pkg.go.dev/github.com/gkampitakis/go-snaps
MIT License
175 stars 6 forks source link

[Feature Request]: Expose `config` type #108

Closed jeremyhcho closed 3 months ago

jeremyhcho commented 3 months ago

🚀 Feature Proposal

Make snaps.config public

Motivation

I'm attempting to use the new MatchStandaloneSnapshot along with the Ext to create individual .json snapshot files for my test. I'd like to set this behavior across all my tests.

Example

type TestSuite struct {
  suite.Suite
  Snapshots *snaps.Config
 }

 func (s *TestSuite) SetupSuite() {
  return &TestSuite{
    Snapshots: snaps.WithConfig(".json")
  }
}

func (s *TestSuite) Test_Something() {
  s.Snapshots.MatchStandaloneSnapshots(...)
}

This would give me the .json behavior by default across all the tests in a suite. Thanks!

gkampitakis commented 3 months ago

Hey 👋 thanks for opening this issue, that's actually a good idea. Totally missed this use case 😅 . Will create a pr to expose the config.