vektra / mockery

A mock code autogenerator for Go
https://vektra.github.io/mockery/
BSD 3-Clause "New" or "Revised" License
6.01k stars 406 forks source link

Combined inpackage mocks into one file #322

Open daniel-toye-vt opened 4 years ago

daniel-toye-vt commented 4 years ago

I currently use

mockery -all -inpkg -testonly -case underscore

It generates a mock of every interface in my package for unit test purposes. Some code in the package accepts interfaces defined in the same package so it helps to test.

However, this generates a large amount of mock_.._test.go files. Just wondering if there could be an option to combine all mocks into a single file?

Thanks!

LandonTClipp commented 4 years ago

I'd say this should be possible, but I don't think I want to introduce it in v2. I'm trying to freeze most new feature requests until the codebase can get into a better/more manageable state (which will be v3).

aeramu commented 3 years ago

waiting for this too :)

fredw commented 2 years ago

Do we have any news on this topic? This would be extremely helpful 😢

LandonTClipp commented 1 year ago

Note: this is still on my radar and I do want to support this. The priority now is getting the packages feature into a production-ready state. Once that's done, I can focus my attention on this.

LightBubblegum commented 11 months ago

Assume that this is same issue where we try to generate several interfaces in the same file but as a result it has only one of them. Right?

imkonsowa commented 4 months ago

Any updates on this?

LandonTClipp commented 4 months ago

There are no updates. I don't have an enormous amount of time to do this at the moment but this is the most requested feature, so it's the next thing I'll work on.

My original blocking task was packages, which has been resoundingly successful and has been completed, so there are no other blockers.

imkonsowa commented 4 months ago

@LandonTClipp Thanks for the great work you are submitting 🙏