Failures
Weaver aggregates failures from all tests to output them after all the tests have finished
import weaver._
import cats.effect._
object MySuite extends SimpleIOSuite {
val randomUUID = IO(java.util.UUID.randomUUID())
pureTest("failing test 1") {
expect(1 >= 2)
}
}
object MyAnotherSuite extends SimpleIOSuite {
import scala.util.Random.alphanumeric
val randomString = IO(alphanumeric.take(10).mkString(""))
test("failing test 2") {
for {
x <- randomString
} yield check(x).traced(here)
}
def check(x : String) = expect(clue(clue(x).length) > 10)
}
The report looks like this:
repl.MdocSessionMdocAppMySuite - failing test 1 0ms repl.MdocSessionMdocAppMyAnotherSuite - failing test 2 2ms *************FAILURES************* repl.MdocSessionMdocAppMySuite - failing test 1 0ms
assertion failed (multiple_suites_failures.md:18) repl.MdocSessionMdocAppMyAnotherSuite - failing test 2 2ms
assertion failed (multiple_suites_failures.md:34)
(multiple_suites_failures.md:31)
Clues {
x: String = 26FqJ0eKvK
clue(x).length: Int = 10
} Total 2, Failed 2, Passed 0, Ignored 0, Cancelled 0