Merge pull request #7686 from eed3si9n/wip/test-quick

[2.x] feat: Rename testQuick to test
This commit is contained in:
eugene yokota 2024-09-21 00:39:07 -04:00 committed by GitHub
commit d2be0447f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 39 additions and 38 deletions

View File

@ -1375,9 +1375,9 @@ object Defaults extends BuildCommon {
} }
}.value, }.value,
// ((streams in test, loadedTestFrameworks, testLoader, testGrouping in test, testExecution in test, fullClasspath in test, javaHome in test, testForkedParallel, javaOptions in test) flatMap allTestGroupsTask).value, // ((streams in test, loadedTestFrameworks, testLoader, testGrouping in test, testExecution in test, fullClasspath in test, javaHome in test, testForkedParallel, javaOptions in test) flatMap allTestGroupsTask).value,
Test / test / testResultLogger :== TestResultLogger.SilentWhenNoTests, // https://github.com/sbt/sbt/issues/1185 Test / testFull / testResultLogger :== TestResultLogger.SilentWhenNoTests, // https://github.com/sbt/sbt/issues/1185
test := { testFull := {
val trl = (Test / test / testResultLogger).value val trl = (Test / testFull / testResultLogger).value
val taskName = Project.showContextKey(state.value).show(resolvedScoped.value) val taskName = Project.showContextKey(state.value).show(resolvedScoped.value)
try trl.run(streams.value.log, executeTests.value, taskName) try trl.run(streams.value.log, executeTests.value, taskName)
finally close(testLoader.value) finally close(testLoader.value)
@ -1389,7 +1389,8 @@ object Defaults extends BuildCommon {
testQuick := { testQuick := {
try inputTests(testQuick).evaluated try inputTests(testQuick).evaluated
finally close(testLoader.value) finally close(testLoader.value)
} },
test := testQuick.evaluated,
) )
private def close(sbtLoader: ClassLoader): Unit = sbtLoader match { private def close(sbtLoader: ClassLoader): Unit = sbtLoader match {

View File

@ -359,9 +359,10 @@ object Keys {
val definedTestNames = taskKey[Seq[String]]("Provides the set of defined test names.").withRank(BMinusTask) val definedTestNames = taskKey[Seq[String]]("Provides the set of defined test names.").withRank(BMinusTask)
val definedTestDigests = taskKey[Map[String, Digest]]("Provides a unique digest of defined tests.").withRank(DTask) val definedTestDigests = taskKey[Map[String, Digest]]("Provides a unique digest of defined tests.").withRank(DTask)
val executeTests = taskKey[Tests.Output]("Executes all tests, producing a report.").withRank(CTask) val executeTests = taskKey[Tests.Output]("Executes all tests, producing a report.").withRank(CTask)
val test = taskKey[Unit]("Executes all tests.").withRank(APlusTask) val test = inputKey[Unit]("Executes the tests that either failed before, were not run or whose transitive dependencies changed, among those provided as arguments.").withRank(ATask)
val testFull = taskKey[Unit]("Executes all tests.").withRank(APlusTask)
val testOnly = inputKey[Unit]("Executes the tests provided as arguments or all tests if no arguments are provided.").withRank(ATask) val testOnly = inputKey[Unit]("Executes the tests provided as arguments or all tests if no arguments are provided.").withRank(ATask)
val testQuick = inputKey[Unit]("Executes the tests that either failed before, were not run or whose transitive dependencies changed, among those provided as arguments.").withRank(ATask) val testQuick = inputKey[Unit]("Alias for test.").withRank(CTask)
@cacheLevel(include = Array.empty) @cacheLevel(include = Array.empty)
val testOptions = taskKey[Seq[TestOption]]("Options for running tests.").withRank(BPlusTask) val testOptions = taskKey[Seq[TestOption]]("Options for running tests.").withRank(BPlusTask)
private[sbt] val testOptionDigests = taskKey[Seq[Digest]]("Digest for testOptions").withRank(DTask) private[sbt] val testOptionDigests = taskKey[Seq[Digest]]("Digest for testOptions").withRank(DTask)

View File

@ -957,7 +957,7 @@ object BuildServerProtocol {
case None => case None =>
// run allTests in testParams.targets // run allTests in testParams.targets
val filter = ScopeFilter.in(testParams.targets.map(workspace.scopes)) val filter = ScopeFilter.in(testParams.targets.map(workspace.scopes))
test.all(filter).result test.toTask("").all(filter).result
} }
Def.task { Def.task {

View File

@ -1,8 +1,8 @@
# Note: this test is meaningless on less than four cores # Note: this test is meaningless on less than four cores
> test > testFull
-> check -> check
> clean > clean
> set testForkedParallel := true > set testForkedParallel := true
> test > testFull
> check > check

View File

@ -29,5 +29,5 @@ inConfig(Test)(Seq(
), Seq((if (test.name.contains("TestA")) TestATypeTag else TestBTypeTag) -> 1)) ), Seq((if (test.name.contains("TestA")) TestATypeTag else TestBTypeTag) -> 1))
} }
}, },
TaskKey[Unit]("test-failure") := test.failure.value TaskKey[Unit]("test-failure") := testFull.failure.value
)) ))

View File

@ -1,3 +1,3 @@
> test > testFull
> set concurrentRestrictions in Global := Seq(Tags.limitAll(4)) > set Global / concurrentRestrictions := Seq(Tags.limitAll(4))
> testFailure > testFailure

View File

@ -23,5 +23,5 @@ inConfig(Test)(Seq(
) )
))} ))}
}, },
TaskKey[Unit]("test-failure") := test.failure.value TaskKey[Unit]("test-failure") := testFull.failure.value
)) ))

View File

@ -1,3 +1,3 @@
> testFailure > testFailure
> set concurrentRestrictions in Global += Tags.limit(Tags.ForkedTestGroup, 1) > set Global / concurrentRestrictions += Tags.limit(Tags.ForkedTestGroup, 1)
> test > testFull

View File

@ -1,6 +1,5 @@
val scalatest = "org.scalatest" %% "scalatest" % "3.0.5" val scalatest = "org.scalatest" %% "scalatest" % "3.0.5"
ThisBuild / scalaVersion := "2.12.19" scalaVersion := "2.12.19"
fork := true fork := true
libraryDependencies += scalatest % Test libraryDependencies += scalatest % Test

View File

@ -1,12 +1,12 @@
> test > testFull
$ copy-file changes/Test.scala src/test/scala/Test.scala $ copy-file changes/Test.scala src/test/scala/Test.scala
> test > testFull
> 'set javaOptions += "-Xno-opt"' > 'set javaOptions += "-Xno-opt"'
-> test -> testFull
> session clear > session clear
> 'set envVars += ("tests.max.value" -> "0")' > 'set envVars += ("tests.max.value" -> "0")'
-> test -> testFull

View File

@ -1,4 +1,4 @@
-> test -> testFull
> checkReport > checkReport
# there might be discrepancies between the 'normal' and the 'forked' mode # there might be discrepancies between the 'normal' and the 'forked' mode
@ -7,5 +7,5 @@
> checkNoReport > checkNoReport
> set Test / fork := true > set Test / fork := true
-> test -> testFull
> checkReport > checkReport

View File

@ -5,7 +5,7 @@
> clean > clean
> test > testFull
$ exists target/SuiteStarting-NestedSpecs $ exists target/SuiteStarting-NestedSpecs

View File

@ -5,7 +5,7 @@
> clean > clean
> test > testFull
$ exists target/SuiteStarting-NestedSpecs $ exists target/SuiteStarting-NestedSpecs

View File

@ -4,7 +4,7 @@ $ absent tested
$ absent cleanup $ absent cleanup
# without Setup configured, the setup file won't exist and the test will fail # without Setup configured, the setup file won't exist and the test will fail
-> testQuick -> testFull
# check that we are starting clean # check that we are starting clean
$ absent setup $ absent setup
@ -15,7 +15,7 @@ $ absent cleanup
$ copy-file changes/setup.sbt setup.sbt $ copy-file changes/setup.sbt setup.sbt
> reload > reload
> test > testFull
# setup should have been deleted by the test # setup should have been deleted by the test
$ absent setup $ absent setup
@ -39,7 +39,7 @@ $ absent tested
$ absent cleanup $ absent cleanup
# without Setup configured, the setup file won't exist and the test will fail # without Setup configured, the setup file won't exist and the test will fail
-> testQuick -> testFull
# check that we are starting clean # check that we are starting clean
$ absent setup $ absent setup
@ -50,7 +50,7 @@ $ absent cleanup
$ copy-file changes/setup.sbt setup.sbt $ copy-file changes/setup.sbt setup.sbt
> reload > reload
> test > testFull
# setup should have been deleted by the test # setup should have been deleted by the test
$ absent setup $ absent setup

View File

@ -1,4 +1,4 @@
val scalatest = "org.scalatest" %% "scalatest" % "3.0.5" val scalatest = "org.scalatest" %% "scalatest" % "3.0.5"
ThisBuild / scalaVersion := "2.12.19" scalaVersion := "2.12.19"
libraryDependencies += scalatest libraryDependencies += scalatest
Test / testOptions += Tests.Argument("-C", "custom.CustomReporter") Test / testOptions += Tests.Argument("-C", "custom.CustomReporter")

View File

@ -6,7 +6,7 @@
> clean > clean
> test > testFull
$ exists target/RunStarting $ exists target/RunStarting

View File

@ -1,20 +1,20 @@
> clean > clean
$ delete src/ $ delete src/
$ copy-file changes/ClassFailModuleSuccess.scala src/test/scala/Test.scala $ copy-file changes/ClassFailModuleSuccess.scala src/test/scala/Test.scala
-> test:test -> testFull
> clean > clean
$ delete src/ $ delete src/
$ copy-file changes/ClassFailModuleFail.scala src/test/scala/Test.scala $ copy-file changes/ClassFailModuleFail.scala src/test/scala/Test.scala
-> test:test -> testFull
> clean > clean
$ delete src/ $ delete src/
$ copy-file changes/ClassSuccessModuleFail.scala src/test/scala/Test.scala $ copy-file changes/ClassSuccessModuleFail.scala src/test/scala/Test.scala
-> test:test -> testFull
> clean > clean
$ delete src/ $ delete src/
$ copy-file changes/ClassSuccessModuleSuccess.scala src/test/scala/Test.scala $ copy-file changes/ClassSuccessModuleSuccess.scala src/test/scala/Test.scala
> test:test > testFull

View File

@ -1,4 +1,4 @@
val scalatest = "org.scalatest" %% "scalatest" % "3.0.5" val scalatest = "org.scalatest" %% "scalatest" % "3.0.5"
ThisBuild / scalaVersion := "2.12.19" scalaVersion := "2.12.19"
libraryDependencies += scalatest libraryDependencies += scalatest
Test / testOptions += Tests.Argument("-C", "custom.CustomReporter") Test / testOptions += Tests.Argument("-C", "custom.CustomReporter")

View File

@ -5,7 +5,7 @@
> clean > clean
> test > testFull
$ exists target/SuiteStarting-TestSpec $ exists target/SuiteStarting-TestSpec