From 8da70221f9ad5c6efa7ff4bd0861e0f4dc74a229 Mon Sep 17 00:00:00 2001 From: LandonTClipp <11232769+LandonTClipp@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:42:47 -0600 Subject: [PATCH] Add deprecation warning for `with-expecter`. --- cmd/mockery.go | 10 ++++++++++ docs/deprecations.md | 16 +++++++++++++++- mockery-tools.env | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/cmd/mockery.go b/cmd/mockery.go index 7e22db43..cc2d3acb 100644 --- a/cmd/mockery.go +++ b/cmd/mockery.go @@ -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) diff --git a/docs/deprecations.md b/docs/deprecations.md index 64903670..3c7b699b 100644 --- a/docs/deprecations.md +++ b/docs/deprecations.md @@ -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: @@ -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`. \ No newline at end of file diff --git a/mockery-tools.env b/mockery-tools.env index 809b21c2..9abcce5a 100644 --- a/mockery-tools.env +++ b/mockery-tools.env @@ -1 +1 @@ -VERSION=v2.49.0 \ No newline at end of file +VERSION=v2.49.1 \ No newline at end of file