mockery icon indicating copy to clipboard operation
mockery copied to clipboard

Regex filter not working for --name

Open damiansima opened this issue 2 years ago • 2 comments

Description

--name does not work as regex

Mockery Version

2.1.4.0

Golang Version

1.18

Installation Method

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

Steps to Reproduce

  1. run mockery --name=^.*SomethingThatMachersAnInterface

Expected Behavior

A mock is generated

Actual Behavior

No mock generated as mockery prints

no matches found: --name=^.*SomethingThatMachersAnInterface

It think it may be related to this https://github.com/vektra/mockery/blob/master/cmd/mockery.go#L180 If name contains regex chars filter never assumes value

damiansima avatar Aug 12 '22 19:08 damiansima

Have you tried wrapping in quotes? Works fine for me.

mockery --name="^.*SomethingThatMachersAnInterface"

Agronis avatar Nov 12 '22 16:11 Agronis

The latest release includes this PR which may help.

leaanthony-sc avatar Aug 22 '23 05:08 leaanthony-sc