-
Notifications
You must be signed in to change notification settings - Fork 393
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
Generating a mock for external _test package #467
Comments
So there have been requests in the past to add a If you want to add a PR for that flag I think that'll solve your problem. |
I would imagine a lot of mocks are generated to be used in _test files, with _test package names. To generate one using mockery is a bit cumbersom. ie this is great
mockery --inpackage --name NodeAndOptionsGetter
but will generate a mock as the main package, meaning having to import it to *_test tests (not the end of the world I know)To get the same mock, with the same MockNodeAndOptionsGetter name, in the same directory, with the same mock_ prefix, but with the _test suffix, and using the _test package, this is what you seemingly have to write:
mockery --output ./ --name NodeAndOptionsGetter --outpkg handler_test --filename mock_NodeAndOptionsGetter_test.go --structname MockNodeAndOptionsGetter
That's a lot of boilerplate, when tbh I would have thought the --testonly flag would do it all (which in fact on it's own is a compile error due to it not bing in a _test.go file). Is there a better way to do it that I'm not seeing?
Version
v2.10.0
The text was updated successfully, but these errors were encountered: