-
Notifications
You must be signed in to change notification settings - Fork 891
Support equivalent of go.generateTestsFlags -template in default test generator #4001
Description
Is your feature request related to a problem? Please describe.
Since #1594, the go.generateTestsFlags setting is no longer honored by the default command.
@h9jiang claimed in the last comment there
The migration from gotests to gopls is now done. Gopls expose the same functionality through source code action.
I argue that the inability to use templates in the gopls version of test generation means it does not expose the same functionality.
For example, while usage of such libraries is controversial, testify is one of the most widely imported packages in the open source Go ecosystem. Being unable to generate unit test templates for projects that use it is a meaningful regression in capabilities.
Yes, the "legacy" generator is still available for now, but calling it legacy gives the impression that the intent is to remove it some time soon.
Additionally:
- If the setting is deprecated, it should be marked as such. Right now there's no indication that it is a legacy setting that's presumably on its way out, nor that it won't work in the default tooling.
- Since the command name hasn't changed, it's quite confusing at first for someone that had it set already that the setting no longer works. This appears as a bug. A notification if the new test generation is invoked that this legacy setting is being ignored might be appropriate (with a "don't show again" option, naturally)
Describe the solution you'd like
I'd like to have the supported test generation support templates, or at least widely used test helper packages, like gotests supports.
Describe alternatives you've considered
- Manually editing the generated code every time is possible but tedious
Additional context
N/A