diff --git a/docs/configuration.md b/docs/configuration.md
index c8d3f45b..e625ef8c 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -193,6 +193,7 @@ Variables that are marked as being templated are capable of using mockery-provid
| InterfaceNameCamel | Converts a string `interface_name` to `InterfaceName` |
| InterfaceNameLowerCamel | Converts `InterfaceName` to `interfaceName` |
| InterfaceNameSnake | Converts `InterfaceName` to `interface_name` |
+| InterfaceNameLower | Converts `InterfaceName` to `interfacename` |
| Mock | A string that is `Mock` if the interface is exported, or `mock` if it is not exported. Useful when setting the name of your mock to something like:
`#!yaml mockname: "{{.Mock}}{{.InterfaceName}}"`
This way, the mock name will retain the exported-ness of the original interface.
| MockName | The name of the mock that will be generated. Note that this is simply the `mockname` configuration variable |
| PackageName | The name of the package from the original interface |
diff --git a/pkg/config/config.go b/pkg/config/config.go
index 855203de..f6cc064a 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -512,7 +512,7 @@ func (c *Config) subPackages(
return nil
})
if walkErr != nil {
- return nil, fmt.Errorf("error occured during filesystem walk: %w", walkErr)
+ return nil, fmt.Errorf("error occurred during filesystem walk: %w", walkErr)
}
// Parse the subdirectories we found into their respective fully qualified
diff --git a/pkg/outputter.go b/pkg/outputter.go
index 5f1caed8..657e96d5 100644
--- a/pkg/outputter.go
+++ b/pkg/outputter.go
@@ -22,7 +22,7 @@ import (
"github.com/vektra/mockery/v2/pkg/stackerr"
)
-var ErrInfiniteLoop = fmt.Errorf("infintie loop in template variables detected")
+var ErrInfiniteLoop = fmt.Errorf("infinite loop in template variables detected")
// Functions available in the template for manipulating
//
@@ -206,6 +206,7 @@ func parseConfigTemplates(ctx context.Context, c *config.Config, iface *Interfac
InterfaceNameCamel string
InterfaceNameLowerCamel string
InterfaceNameSnake string
+ InterfaceNameLower string
Mock string
MockName string
PackageName string
@@ -217,6 +218,7 @@ func parseConfigTemplates(ctx context.Context, c *config.Config, iface *Interfac
InterfaceNameCamel: strcase.ToCamel(iface.Name),
InterfaceNameLowerCamel: strcase.ToLowerCamel(iface.Name),
InterfaceNameSnake: strcase.ToSnake(iface.Name),
+ InterfaceNameLower: strings.ToLower(iface.Name),
Mock: mock,
MockName: c.MockName,
PackageName: iface.Pkg.Name(),
@@ -236,7 +238,7 @@ func parseConfigTemplates(ctx context.Context, c *config.Config, iface *Interfac
changesMade := true
for changesMade {
if numIterations >= 20 {
- msg := "infintie loop in template variables detected"
+ msg := "infinite loop in template variables detected"
log.Error().Msg(msg)
for key, val := range templateMap {
l := log.With().Str("variable-name", key).Str("variable-value", *val).Logger()
diff --git a/pkg/outputter_test.go b/pkg/outputter_test.go
index 4e224c55..013140f9 100644
--- a/pkg/outputter_test.go
+++ b/pkg/outputter_test.go
@@ -97,7 +97,7 @@ func Test_parseConfigTemplates(t *testing.T) {
args: args{
c: &config.Config{
Dir: "{{.InterfaceDir}}/{{.PackagePath}}",
- FileName: "{{.InterfaceName}}_{{.InterfaceNameCamel}}_{{.InterfaceNameSnake}}.go",
+ FileName: "{{.InterfaceName}}_{{.InterfaceNameCamel}}_{{.InterfaceNameSnake}}_{{.InterfaceNameLower}}.go",
MockName: "{{.InterfaceNameLowerCamel}}",
Outpkg: "{{.PackageName}}",
},
@@ -110,7 +110,7 @@ func Test_parseConfigTemplates(t *testing.T) {
pkg: mockPkg,
want: &config.Config{
Dir: "path/to/github.com/user/project/package",
- FileName: "FooBar_FooBar_foo_bar.go",
+ FileName: "FooBar_FooBar_foo_bar_foobar.go",
MockName: "fooBar",
Outpkg: "packageName",
},