-
Notifications
You must be signed in to change notification settings - Fork 449
Description
Description
Problem
I'm attempting to migrate from mockery v2 to v3. In v2, I successfully used the --dir flag to generate mocks for specific directories:
mockery --dir internal/path/ \
--inpackage \
--allAfter upgrading to v3, this command now fails with:
Error: unknown flag: --dir
Expected Behavior
According to the v3 configuration documentation, the parameter table lists dir as a configuration option with a default value of "{{.InterfaceDir}}". The documentation states:
"Config can not only be specified from the
.ymlfile, but also from CLI parameters (where available) and environment variables."
This suggests that dir should be available as a CLI flag, similar to how other parameters like --all, --inpackage, etc., work.
Current Workaround
I'm aware that I can use a .mockery.yml config file with the packages section to specify directories:
packages:
internal/path/:
config:
all: true
inpackage: trueHowever, this significantly changes the workflow, especially for projects with many directories that need mock generation (I have 99+ usages of mockery --dir across my makefiles).
Questions
- Is the
--dirflag intentionally removed in v3, or is this a bug? - If intentionally removed, should the documentation be updated to clarify which parameters are available as CLI flags?
- Is there a recommended migration path for projects heavily relying on the
--dirflag beyond converting everything to YAML config?
Environment
- mockery version: v3.x (please specify your exact version)
- Operating System: macOS (darwin 24.6.0)
- Go version: go1.25.2 darwin/arm64
Additional Context
The migration from v2 to v3 would be much smoother if either:
- The
--dirflag is restored/fixed in v3, or - Clear migration documentation is provided explaining the new approach and why
--diris no longer supported