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,
// ((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 := {
val trl = (Test / test / testResultLogger).value
Test / testFull / testResultLogger :== TestResultLogger.SilentWhenNoTests, // https://github.com/sbt/sbt/issues/1185
testFull := {
val trl = (Test / testFull / testResultLogger).value
val taskName = Project.showContextKey(state.value).show(resolvedScoped.value)
try trl.run(streams.value.log, executeTests.value, taskName)
finally close(testLoader.value)
@ -1389,7 +1389,8 @@ object Defaults extends BuildCommon {
testQuick := {
try inputTests(testQuick).evaluated
finally close(testLoader.value)
}
},
test := testQuick.evaluated,
)
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 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 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 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)
val testOptions = taskKey[Seq[TestOption]]("Options for running tests.").withRank(BPlusTask)
private[sbt] val testOptionDigests = taskKey[Seq[Digest]]("Digest for testOptions").withRank(DTask)

View File

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

View File

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

View File

@ -29,5 +29,5 @@ inConfig(Test)(Seq(
), 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
> set concurrentRestrictions in Global := Seq(Tags.limitAll(4))
> testFull
> set Global / concurrentRestrictions := Seq(Tags.limitAll(4))
> 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
> set concurrentRestrictions in Global += Tags.limit(Tags.ForkedTestGroup, 1)
> test
> set Global / concurrentRestrictions += Tags.limit(Tags.ForkedTestGroup, 1)
> testFull

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,20 +1,20 @@
> clean
$ delete src/
$ copy-file changes/ClassFailModuleSuccess.scala src/test/scala/Test.scala
-> test:test
-> testFull
> clean
$ delete src/
$ copy-file changes/ClassFailModuleFail.scala src/test/scala/Test.scala
-> test:test
-> testFull
> clean
$ delete src/
$ copy-file changes/ClassSuccessModuleFail.scala src/test/scala/Test.scala
-> test:test
-> testFull
> clean
$ delete src/
$ 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"
ThisBuild / scalaVersion := "2.12.19"
scalaVersion := "2.12.19"
libraryDependencies += scalatest
Test / testOptions += Tests.Argument("-C", "custom.CustomReporter")

View File

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