mirror of https://github.com/sbt/sbt.git
[2.x] fix: Prefer direct key selection for testFull at root (#8775)
**Problem** `testFull` can select an aggregate-only key before a directly defined root key. In issue #8772 this causes root project tests to be skipped, so a failing root test can pass unexpectedly. **Solution** Prefer directly defined keys in `Act.select`, and only fall back to aggregate-only candidates when no direct key exists. Add scripted regression test `tests/i8772-root-project-testfull` and keep `project/extra-projects-key-aggregate` behavior intact.
This commit is contained in:
parent
a7d5f45515
commit
ae1066ed12
|
|
@ -216,7 +216,9 @@ object Act {
|
|||
case None => noValidKeys
|
||||
case Some(x) => success(x)
|
||||
val validFilter = structure.fold(isValid(data))(isValidForAggregate(data, _))
|
||||
selectFromValid(ss filter validFilter, default)
|
||||
val valid = ss filter validFilter
|
||||
val directlyDefined = valid filter isValid(data)
|
||||
selectFromValid(if directlyDefined.nonEmpty then directlyDefined else valid, default)
|
||||
}
|
||||
|
||||
private def isValidForAggregate(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
ThisBuild / scalaVersion := "2.13.18"
|
||||
|
||||
lazy val a = project
|
||||
|
||||
lazy val b = project
|
||||
.in(file("."))
|
||||
.settings(
|
||||
libraryDependencies += "org.scalatest" %% "scalatest-funsuite" % "3.2.19" % Test
|
||||
)
|
||||
.dependsOn(a)
|
||||
.aggregate(a)
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package example
|
||||
|
||||
import org.scalatest.funsuite.AnyFunSuite
|
||||
|
||||
class Test1 extends AnyFunSuite {
|
||||
fail("This test should fail")
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
-> testFull
|
||||
Loading…
Reference in New Issue