You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Subpackages/subdirectories may contain further mockery config files. Currently mockery recursion from a config in a parent directory will ignore these, meaning those packages/directories may have different mocks generated depending on where mockery is run from.
I'm not 100% sure I have a use-case for this, but in a larger mono-repo it would be nice to not have the entire configuration at the root of the repo so some subdirectory can customise, while still being able to run mockery across the repo. An alternative approach might be running a find -name .mockery.yaml -execdir mockery, but that still leaves the danger of someone creating mockery configs in subdirectories that cause inconsistent behaviour.
I took a quick try at implementing this but then realised that the config name is in theory variable (I think? viper gets it from somewhere)
Mockery Version
v2.33.3
Golang Version
go1.21.3
Installation Method
Binary Distribution
Docker
brew
go install
Other: [specify]
Steps to Reproduce
go mod init github.com/something
touch .mockery.yaml
mkdir foo && touch foo/mockery.yaml
set recursive:true for github.com/something in root .mockery.yaml
set some extra setting like mockname for github.com/something/foo in foo/.mockery.yaml
create an interface in a go file in the foo package
run mockery in the root, notice that setting changes from the foo are ignored
run mockery in the foo directory, settings from foo directory are applied
Expected Behavior
A few options:
Error as invalid on a subdirectory with a config
Stop recursion on a subdirectory with a config
Try to merge the encountered config into the semantics of the recursion
Actual Behavior
Config in subdirectory is silently ignored
The text was updated successfully, but these errors were encountered:
Description
Split from #706
Subpackages/subdirectories may contain further mockery config files. Currently mockery recursion from a config in a parent directory will ignore these, meaning those packages/directories may have different mocks generated depending on where mockery is run from.
I'm not 100% sure I have a use-case for this, but in a larger mono-repo it would be nice to not have the entire configuration at the root of the repo so some subdirectory can customise, while still being able to run mockery across the repo. An alternative approach might be running a
find -name .mockery.yaml -execdir mockery
, but that still leaves the danger of someone creating mockery configs in subdirectories that cause inconsistent behaviour.I took a quick try at implementing this but then realised that the config name is in theory variable (I think? viper gets it from somewhere)
Mockery Version
v2.33.3
Golang Version
go1.21.3
Installation Method
Steps to Reproduce
Expected Behavior
A few options:
Actual Behavior
The text was updated successfully, but these errors were encountered: