Generate working main() methods in test files #3582
Labels
in editor
Relates to code editing or language features
in lsp/analysis server
Something to be fixed in the Dart analysis server
is enhancement
Milestone
Is your feature request related to a problem? Please describe.
When you create a new test file for use with
package:test
, you need amain
method without arguments (e.g.void main()
). However, themain
template in vscode will insertvoid main(List<String> arguments) {...
. The analyzer can't find an issue with that because it's a valid main method. However, running the tests fails becausepackage:test
barfs at the main method.Describe the solution you'd like
A context aware template that inserts the
main
method with arguments in regular dart files but inserts amain
method without arguments in_test.dart
files. (Or alternatively, a second template that also comes up when you typemain
and inserts something appropriate for tests, perhaps even contains a bit more common test skeleton code like an actual test method or setUp/tearDown calls).@pq
The text was updated successfully, but these errors were encountered: