Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
recursive
option for packages
feature
This commit allows you to specify `recursive: true` for the `packages` config feature. This will recursively search for all packages on-disk so that you don't have to manually specify them in the mockery config. Fixes #594 clarify showconfig functionality Add debug logs for generator Fix sub-package config merging updates Add tests for discoverRecursivePackages simplify test call Initialize for test instead fix linting issue add test for showconfig
- Loading branch information
1 parent
7dad3a3
commit 8a6a6bb
Showing
15 changed files
with
664 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ docs/ve | |
ve | ||
.cache | ||
coverage.txt | ||
site/ | ||
site/ | ||
.task/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,3 @@ packages: | |
- mockname: RequesterVariadic | ||
Expecter: | ||
RequesterReturnElided: | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,40 @@ | ||
package cmd | ||
|
||
import ( | ||
"bytes" | ||
"testing" | ||
|
||
"github.com/chigopher/pathlib" | ||
"github.com/spf13/viper" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestNewShowConfigCmd(t *testing.T) { | ||
cmd := NewShowConfigCmd() | ||
assert.Equal(t, "showconfig", cmd.Name()) | ||
} | ||
|
||
func TestShowCfg(t *testing.T) { | ||
v := viper.New() | ||
v.Set("with-expecter", true) | ||
cfgFile := pathlib.NewPath(t.TempDir()).Join("config.yaml") | ||
err := cfgFile.WriteFile([]byte(` | ||
with-expecter: true | ||
all: true | ||
packages: | ||
github.com/vektra/mockery/v2/pkg: | ||
config: | ||
all: true`)) | ||
assert.NoError(t, err) | ||
v.Set("config", cfgFile.String()) | ||
buf := new(bytes.Buffer) | ||
assert.NoError(t, showConfig(nil, nil, v, buf)) | ||
assert.Equal(t, `all: true | ||
packages: | ||
github.com/vektra/mockery/v2/pkg: | ||
config: | ||
all: true | ||
with-expecter: true | ||
with-expecter: true | ||
`, buf.String()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.