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

Is there some way to override --no-create? #50

Open
brprice opened this issue Mar 10, 2022 · 1 comment
Open

Is there some way to override --no-create? #50

brprice opened this issue Mar 10, 2022 · 1 comment

Comments

@brprice
Copy link

brprice commented Mar 10, 2022

I find it too easy to mess up with the default configuration of creating missing golden files. Either by forgetting to commit the file, or by running the testsuite from the wrong working directory (which is easy in a multi-package project, and using cabal run library-test) and not noticing that it only passes because it did not find the golden files. Or worse: forgetting to set --no-create in CI.

I feel it would work better for me if I could configure tasty-golden such that a missing golden file were considered an error, unless a flag is passed to create the file. I had hoped that setting --no-create permanently (in my use case, via tasty-discover) would enable this, but afaict I cannot then override it on the rare occasion that I add a new golden test.

On the other hand, maybe I am missing something, and a better question may be "why do we default to creating missing golden files?"

@amesgen
Copy link

amesgen commented Jun 3, 2022

It would be possible to make --no-create the default if the NoCreateFile option would be exported (just opened #52 to do that), namely by wrapping the golden TestTree with

localOption (NoCreateFile True)

Then --no-create-file still can't be used to reenable creation of files, but it can be changed in code selectively.

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

2 participants