Skip to content

Missing test run? #252

@anthony-cros

Description

@anthony-cros

I have:

$ cat build.sbt 
libraryDependencies += "com.lihaoyi" %% "utest" % "0.7.10" % "test"
testFrameworks += new TestFramework("utest.runner.Framework")

and

$ cat src/test/scala/HelloTests.scala 
package test.utest.examples
import utest._
object HelloTests extends TestSuite {
  val tests = Tests {
    test {  1  }
    test { "a" }
    test { throw new Exception("foo") }
    test {  2  }
    test { "b" }    
  }
}

and upon running sbt test, I obtain:

...
[info] welcome to sbt 1.4.7 (Oracle Corporation Java 1.8.0_161)
...
[info] compiling 1 Scala source to [...]/target/scala-2.12/test-classes ...
-------------------------------- Running Tests --------------------------------
+ test.utest.examples.HelloTests.0 1ms  1
+ test.utest.examples.HelloTests.1 0ms  a
X test.utest.examples.HelloTests.2 0ms 
  java.lang.Exception: foo
    test.utest.examples.HelloTests$.$anonfun$tests$4(HelloTests.scala:7)
+ test.utest.examples.HelloTests.3 0ms  2
[info] Tests: 4, Passed: 3, Failed: 1
[error] Failed tests:
[error] 	test.utest.examples.HelloTests
[error] (Test / test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 2 s, completed May 28, 2021 1:56:11 PM

I would expect there to run five tests, not four. Am I missing something or is this an actual issue?

PS: I actually do care about not having to name my tests (at least not all of them)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions