Skip to content

There is no command to run a main method in test scope #2728

@bishabosha

Description

@bishabosha

Is your feature request related to a problem? Please describe.

Currently the only way to run a main method in test scope is through the IDE (e.g. Metals code lens for run|debug). It would be good to have a programmatic way to do this from the scala command.

Describe the solution you'd like
The run command should accept the --test flag, like you can do in the compile command. Then this does not try to invoke test frameworks, rather scans for main methods in test scope, in the same manner that run currently looks for main methods in the main scope.

I guess this should filter out any main methods possibly included from main scope, but it is not a strong requirement.

Describe alternatives you've considered
N/A

Additional context
Here is a forum request for this feature (equivalent of Test/runMain in sbt): https://users.scala-lang.org/t/getting-started-with-scala-cli/9788

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions