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 3ms

*************FAILURES*************
repl.MdocSessionMdocAppMySuite
failing test 1 0ms
  assertion failed (multiple_suites_failures.md:18)

  expect(1 >= 2)

  Use the `clue` function to troubleshoot

  multiple_suites_failures.md:18
      expect(1 >= 2)
            ^
repl.MdocSessionMdocAppMyAnotherSuite failing test 2 3ms
  assertion failed (multiple_suites_failures.md:34)
 (multiple_suites_failures.md:31)

  expect(clue(clue(x).length) > 10)

  Clues {
    x: String = bK80GOOIKJ
    clue(x).length: Int = 10
  }

  multiple_suites_failures.md:34
    def check(x : String) = expect(clue(clue(x).length) > 10)
                                  ^
  multiple_suites_failures.md:31
      } yield check(x).traced(here)
                              ^
Total 2, Failed 2, Passed 0, Ignored 0, Cancelled 0