Skip to content

Draft: Autogenerate mocks #377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Draft: Autogenerate mocks #377

wants to merge 4 commits into from

Conversation

lorenzodonini
Copy link
Owner

Proposed changes

Generated mock files are not committed to VCS anymore and are ignored by git instead. This prevents from running a CI job for committing updated mocks to the repo after each pull request.

To run unit tests, the mocks still need to be generated. This can be done either:

  • running mockery or
  • via the provided make mocks command

Mocks are auto-generated in the CI before running unit tests.

Types of changes

What types of changes does your code introduce?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Further comments

Possibly a controversial change, but I believe having auto-generated files checked in is more of a burden. For local development the mocks will ideally be generated once and forgotten. The CI has to generate them each time but the step takes ~15s, so not a big deal.

@lorenzodonini lorenzodonini marked this pull request as draft August 16, 2025 12:40
@lorenzodonini lorenzodonini mentioned this pull request Aug 16, 2025
10 tasks
uses: jaxxstorm/[email protected]
with: # Grab a specific tag
repo: vektra/mockery
tag: v2.53.3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably bump to v3

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, done

@lorenzodonini lorenzodonini force-pushed the mocks-autogen branch 2 times, most recently from 28a619b to 6792698 Compare August 16, 2025 21:09
Signed-off-by: Lorenzo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants