bradleyjkemp / cupaloy

Simple Go snapshot testing
MIT License
308 stars 26 forks source link

Update cupaloy.go #43

Closed byang223 closed 6 years ago

byang223 commented 6 years ago
cupaloy.Global = cupaloy.Global.WithOptions(
        cupaloy.CreateNewAutomatically(false),
        cupaloy.EnvVariableName(updateSnapshotsEnv),
        cupaloy.FailOnUpdate(false),
        cupaloy.ShouldUpdate(func() bool { return updateSnapshot}),
        cupaloy.SnapshotSubdirectory(updateSnapshotsDir),
    )

Sorry missed this earlier. This is the set of config I'm using. When snapshots don't exist and I'm running in bazel setting it is not failing as expected.

byang223 commented 6 years ago

Sorry don't have too much experience on Github/Pull Requests, would probably be better if you could commandeer this small edit.

bradleyjkemp commented 6 years ago

Ouch, nice catch. I think you just need two small changes to TestGlobalCreateNewAutomatically in order to make the tests pass:

If you want to do that then I'm happy to merge this. Or if not then I can do it, just let me know :)

byang223 commented 6 years ago

updated the tests