Skip to content

Commit

Permalink
Add deprecation warning for with-expecter.
Browse files Browse the repository at this point in the history
  • Loading branch information
LandonTClipp committed Nov 21, 2024
1 parent 55e1e90 commit 8da7022
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
10 changes: 10 additions & 0 deletions cmd/mockery.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,16 @@ func (r *RootApp) Run() error {
boilerplate = string(data)
}

if !r.Config.WithExpecter {
logging.WarnDeprecated(
ctx,
"with-expecter will be permanently set to True in v3",
map[string]any{
"url": logging.DocsURL("/deprecations/#with-expecter"),
},
)
}

configuredPackages, err := r.Config.GetPackages(ctx)
if err != nil && !errors.Is(err, os.ErrNotExist) {
return fmt.Errorf("failed to determine configured packages: %w", err)
Expand Down
16 changes: 15 additions & 1 deletion docs/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if being generated with `#!yaml inpackage: True`.
```

This parameter directs Mockery on whether it should resolve a type alias to its underlying, real
type or if it should generate mocks by referencing. Mockery was changed in [#808](https://github.com/vektra/mockery/pull/808)
type or if it should generate mocks by referencing the alias. Mockery was changed in [#808](https://github.com/vektra/mockery/pull/808)
to support a new language feature that exposed type aliases in the parsed syntax tree. This meant
that Mockery was now explicitly aware of aliases, which fixed a number of problems:

Expand All @@ -77,3 +77,17 @@ However, it was discovered in [#839](https://github.com/vektra/mockery/issues/83

For all new projects that use Mockery, there is no reason to resolve type aliases so this parameter should almost always
be set to `False`. This will be the permanent behavior in Mockery v3.

`with-expecter`
---------------

!!! tip ""

To resolve this warning:

```yaml title=".mockery.yaml"
with-expecter: True
```

This parameter enables the [expecter structs](features.md#expecter-structs). In Mockery v3, this parameter will be permanently
enabled. In order to remove the deprecation warning, you must set this parameter to `#!yaml with-expecter: True`.
2 changes: 1 addition & 1 deletion mockery-tools.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION=v2.49.0
VERSION=v2.49.1

0 comments on commit 8da7022

Please sign in to comment.