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:
MySuite - failing test 1 0ms MyAnotherSuite - failing test 2 2ms *************FAILURES************* MySuite - failing test 1 0ms
assertion failed
expect(1 >= 2)
Use the `clue` function to troubleshoot
multiple_suites_failures.md#L18
expect(1 >= 2)
^ MyAnotherSuite - failing test 2 2ms
assertion failed
expect(clue(clue(x).length) > 10)
Clues {
x: String = 6lRAlvv1zA
clue(x).length: Int = 10
}
multiple_suites_failures.md#L34
def check(x : String) = expect(clue(clue(x).length) > 10)
^
multiple_suites_failures.md#L31
} yield check(x).traced(here)
^ Total 2, Failed 2, Passed 0, Ignored 0