scala-cli
scala-cli copied to clipboard
Run specific test by `--only` option
Is your feature request related to a problem? Please describe.
In my project https://github.com/tanishiking/monkeys, there are multiple test files such as parser/Parser.test.scala
and scanner/Scanner.test.scala
.
We can run all tests by scala-cli test .
, however, we can't run a specific test.
For example scala-cli test parser/Parser.test.scala
doesn't compile because parser/Parser.test.scala
depends on scanner/Scanner.scala
.
Describe the solution you'd like
It would be great if we can run only specified tests by scala-cli test . --only <FQN-of-test>
Describe alternatives you've considered
Just run all tests by scala-cli test .
Additional context testOnly, test
I am not sure about the naming of the --only
flag, but we definitely should have some reasonable way of filtering tests.
It will probably take time to fully support each of the major test frameworks, but we should be able to support most through JUnit
.
TLDR; let's do a spike on this first.
For reference: with the JUnit Interface it is already possible to run specific tests, just not a specific complete suite. For example, in the monkeys
project from @tanishiking:
% scala-cli test . -- --tests=return-statement
==> i monkeys.parser.ParserTests.let-statement ignored 0.0s
monkeys.parser.ParserTests:
+ return-statement 0.02s
==> i monkeys.scanner.SnannerTests.basic ignored 0.0s
==> i monkeys.scanner.SnannerTests.advanced ignored 0.0s
monkeys.scanner.SnannerTests:
For reference: with the JUnit Interface it is already possible to run specific tests, just not a specific complete suite.
Oh, huh, I didn't realise it was this easy, already. I suspect adding support for running a specific complete suite shouldn't be very hard, either. We'll see about some sort of smarter filtering of the tests as well, once this ticket is picked up.
This has been done in https://github.com/VirtusLab/scala-cli/pull/1604, closing the ticket.