Skip to content

[2.x] ignore root project tests #8772

@xuwei-k

Description

@xuwei-k

steps

xuwei-k/sbt-2-root-test-empty-aggregate@4395904

b/build.sbt

val common = Def.settings(
  scalaVersion := "2.13.18"
)

lazy val a = project
  .settings(
    common,
  )

lazy val b = project
  .in(file("."))
  .settings(
    common,
    libraryDependencies += "org.scalatest" %% "scalatest-funsuite" % "3.2.19" % Test,
  )
  .dependsOn(a)
  .aggregate(a)

project/build.properties

sbt.version=2.0.0-RC9

src/test/scala/Test1.scala

package example

import org.scalatest.funsuite.AnyFunSuite

class Test1 extends AnyFunSuite {
  fail("This test should fail")
}

problem

sbt testFull

[success] elapsed time: 1 s

expectation

run example.Test1 and then report failure. same as sbt 1.x

notes

sbt 1.12.3

[info] compiling 1 Scala source to /home/runner/work/sbt-2-root-test-empty-aggregate/sbt-2-root-test-empty-aggregate/target/scala-2.13/test-classes ...
[info] done compiling
[info] Test1:
[info] example.Test1 *** ABORTED ***
[info]   This test should fail (Test1.scala:6)
[info] Run completed in 134 milliseconds.
[info] Total number of tests run: 0
[info] Suites: completed 0, aborted 1
[info] Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0
[info] *** 1 SUITE ABORTED ***
[error] Error during tests:
[error] 	example.Test1
[error] (Test / test) sbt.TestsFailedException: Tests unsuccessful

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions