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

Add deprecation warning for with-expecter. #851

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading