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

Unexpected default path of approved files #16

Open
objarni opened this issue Jan 4, 2021 · 1 comment
Open

Unexpected default path of approved files #16

objarni opened this issue Jan 4, 2021 · 1 comment

Comments

@objarni
Copy link
Contributor

objarni commented Jan 4, 2021

Go has a convention to put test data files under projectroot/testdata, I think it makes sense to store approved (and temporary/received files possibly too) there by default. Possibly making this configurable, but that is less important imho.

See https://ieftimov.com/post/testing-in-go-golden-files/ for more info. Side note: Maybe that blogger is interested in helping out on this lib too, (s)he seems to know quite a bit on approval tests, even if the terminology is somewhat dated (golden files in the blog post).

@dertseha
Copy link
Contributor

As a detail, testdata does not have to be in the root of the project, it is generally ignored. So it is possible to have package-specific testdata subfolder holding related samples.

As per go help test:

The go tool will ignore a directory named "testdata", making it available to hold ancillary data needed by the tests.

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