Skip to content
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

Files being created even with dry-run: true #769

Closed
1 of 5 tasks
danielleallopez opened this issue Mar 19, 2024 · 1 comment · Fixed by #789
Closed
1 of 5 tasks

Files being created even with dry-run: true #769

danielleallopez opened this issue Mar 19, 2024 · 1 comment · Fixed by #789
Labels
bug good-first-issue Good issue for beginners or first-time contributors to tackle

Comments

@danielleallopez
Copy link

PLEASE READ

DO NOT submit tickets without first using the latest version of Golang, clearing your local golang package cache, and re-building mockery using the latest Golang version and the latest version of mockery. Please provide evidence this has been done in your issue. Failure to provide this evidence will likely result in your issue being closed.

Description

Running mockery with dry-run: true creates files instead of only printing logs

Mockery Version

2.42.1

Golang Version

1.22.0

NOTE: Please upgrade to the latest golang version before submitting tickets!

Installation Method

  • Binary Distribution
  • Docker
  • brew
  • go install
  • Other: [specify]

Steps to Reproduce

  1. Create .mockery.yaml config file with dry-run: true
dir: "test/mocks"
outpkg: "mocks"
filename: "{{.InterfaceName | snakecase}}.go"
mockname: "{{.InterfaceName}}"
inpackage: false
testonly: false
with-expecter: true
keeptree: false
dry-run: true
packages:
  github.com/mycompany/internal:
    config:
      all: true
      recursive: true
  1. Run mockery on same folder

Expected Behavior

Logs are printed, showing which files would be created

Actual Behavior

Files are actually created

19 Mar 24 11:44 CET INF generating mocks for interface dry-run=true interface=foo qualified-name=github.com/mycompany/internal version=v2.42.1
19 Mar 24 11:44 CET INF writing to file dry-run=true file=test/mocks/foo.go interface=foo qualified-name=github.com/mycompany/internal version=v2.42.1

@LandonTClipp
Copy link
Collaborator

This may have been a regression when I rolled out packages, should be an easy fix.

@LandonTClipp LandonTClipp added bug good-first-issue Good issue for beginners or first-time contributors to tackle labels Mar 19, 2024
harshvar2 pushed a commit to harshvar2/mockery that referenced this issue Apr 27, 2024
harshvar2 pushed a commit to harshvar2/mockery that referenced this issue Apr 27, 2024
…run mode is enabled

- dynamically set dry run config during Outputter initialization
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good-first-issue Good issue for beginners or first-time contributors to tackle
Projects
None yet
2 participants