vektra / mockery

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

Support empty `.mockery.yaml` config #792

Open austince opened 2 months ago

austince commented 2 months ago

Description

Support empty .mockery.yaml files. We have set up support for mockery for all packages in our repo but some do not (yet) need mocks. In order to avoid special-casing these packages in the generation commands, it would be great if mockery accepted this as a valid case and no-oped instead of failing.

Mockery Version

v2.43.2

Golang Version

1.22.4

Installation Method

Steps to Reproduce

  1. Create a .mockery.yaml config with the contents:
    1. with-expecter: true
  2. Run mockery

Expected Behavior

Successful run with no generation.

Actual Behavior

Error

       09 Jul 24 11:12 EDT FTL Use --name to specify the name of the interface or --all for all interfaces found dry-run=false version=v2.43.2
LandonTClipp commented 2 months ago

If the intention is to use packages, then there is no feasible way to do this until we move to v3 and remove legacy configuration semantics. The existence of the packages config value is a feature flag that enables it. When mockery doesn't see this, it reverts to the old semantics.