Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-update flag doing nothing #26

Open
danawoodman opened this issue Dec 23, 2019 · 3 comments
Open

-update flag doing nothing #26

danawoodman opened this issue Dec 23, 2019 · 3 comments

Comments

@danawoodman
Copy link
Contributor

danawoodman commented Dec 23, 2019

I have a test file like:

// +build e2e

package e2e

import (
	"testing"

	"github.com/sebdah/goldie/v2"
)

func TestFoo(t *testing.T) {
	g := goldie.New(t)
	out := []byte("some-text")
	g.Assert(t, "example", out)
}

And I am running:

go test -tags=e2e -update -clean ./...

And the output is:

?   	github.com/myrepo/myproj	[no test files]

I would expect it to create the golden file but it does nothing. If I remove the -update flag the the test runs but fails because of no golden file.

Manually creating the golden file does work but I cannot get the -update flag to create the file.

I am using v2.

Any ideas what I am doing wrong?

@wreulicke
Copy link

wreulicke commented Apr 14, 2021

@danawoodman
I am not sure that -update does not work, but this is solved by adding flags after ./...

@jdemeyer
Copy link

jdemeyer commented Oct 13, 2021

I am not sure that -update does not work, but this is solved by adding flags after ./...

Unfortunately, that breaks if you're also testing other packages which don't use goldie:

$ go test ./... -update
flag provided but not defined: -update
[...]

@StarpTech
Copy link

Same. Can anyone provide a solution. @sebdah do you have time to investigate?

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

No branches or pull requests

4 participants