Open lmserrano opened 3 years ago
Still facing this problem with current latest versions (ZIO 1.0.9, Scala 2.13.6, Java 16, IntelliJ 2021.1.2)
Current example:
import HelloWorld._
import zio._
import zio.console._
import zio.test.Assertion._
import zio.test.TestAspect.ignore
import zio.test._
import zio.test.environment._
import java.io.IOException
object HelloWorld {
def sayHello: ZIO[Console, IOException, Unit] =
console.putStrLn("Hello, World!")
def sayGoodbye: ZIO[Console, IOException, Unit] =
console.putStrLn("Goodbye, World!")
}
object HelloWorldSpec extends DefaultRunnableSpec {
def spec = suite("HelloWorldSpec")(
testM("sayHello correctly displays output") {
for {
_ <- sayHello
output <- TestConsole.output
} yield assert(output)(equalTo(Vector("Hello, World!\n")))
},
testM("sayGoodbye correctly displays output") {
for {
_ <- sayGoodbye
output <- TestConsole.output
} yield assert(output)(equalTo(Vector("Goodbye, World!\n")))
}
)
}
object HelloWorld2Spec extends DefaultRunnableSpec {
def spec = suite("HelloWorldSpec2")(
testM("sayHello correctly displays output") {
for {
_ <- sayHello
output <- TestConsole.output
} yield assert(output)(equalTo(Vector("Hello, FAILS World!\n")))
},
testM("sayGoodbye correctly displays output") {
for {
_ <- sayGoodbye
output <- TestConsole.output
} yield assert(output)(equalTo(Vector("Goodbye, World!\n")))
} @@ ignore
)
}
If I right click the project root and select the option to run all tests, it will return the same error message in the issue's description.
Thanks for the report. I'll try to figure it out soon.... sorry for the trouble!
Problem
When there is more than one
object
in the project/module'stest/scala
sources, when using IntelliJ to run the unit tests, the operation will fail with the plugin claiming that it isUnable to find the spec class name in the command-line args.
.Steps to reproduce:
zioVersion = 1.0.4-2
)."dev.zio" %% "zio-test-sbt" % zioVersion % Test
to the list of default generatedlibraryDependencies
.Add an object similar with one of the suggested examples in the ZIO webpage - How to - Running Tests, as follows:
Run ZIO tests in <project/module-name>
to run all its tests. It will work.Repeat step 3. and attempt to run all the tests. The operation will fail because it is not capable of identifying which tests to run. The error message is as follows:
Versions
Feb 05, 2021 Version 2020.3.5.1
(Taken from the plugin's URL and by verifying the plugin is up to date, since IntelliJ doesn't seem to show plugin version inside the IDE itself)