Provide option to skip generating mocks for parent protocols outside package
Overview
It looks like the generated mock file will contain mocks for inherited protocols by design. Can we improve the generator to exclude them? Or is there a way to do this that I'm unaware of.
Example
Swift Package "Base":
public protocol BaseProtocol {
func getBar() -> Int
}
Swift Package "Middle":
public protocol MiddleProtocol: BaseProtocol {
func getFoo() -> Int
}
Now run the generator using the following command:
cuckoo_generator generate --glob Base/Sources/Base/* --glob Middle/Sources/Middle/* --output Middle/Tests/MiddleTests/MiddleTestMocks.swift --testable Middle
We would get both MockMiddleProtocol and MockBaseProtocol inside the file MiddleTestMocks.swift.
Expected Behavior
Using the above example, I'm looking for a way to not contain MockBaseProtocol inside BaseMiddleMocks. This can probably be configurable via a new command line argument like supportGlob. It indicates the file necessary to generate the correct mocks that contains parent methods but does not generate mock for parent protocols themselves.
cuckoo_generator generate --glob Middle/Sources/Middle/* --supportGlob Base/Sources/Base/* --output Middle/Tests/MiddleTests/MiddleTestMocks.swift --testable Middle
Looking forward to see other's thoughts. Thanks.
Hey there, @juyan. Does excluding the MiddleProtocol on its own do what you need? I'm not against adding support for this case, but I'd refrain from adding more CLI flags if possible.
@MatyasKriz sorry there was something wrong in my example and I fixed it. Please take a look again, hope it makes more sense now.