Skip to content

Commit

Permalink
feat: Rename testQuick to test
Browse files Browse the repository at this point in the history
**Problem**
We have incremental testing, but it's not used by default.

**Solution**
This renames testQuick to test, and test to testFull.
  • Loading branch information
eed3si9n committed Sep 19, 2024
1 parent 336b752 commit 2a3ea08
Show file tree
Hide file tree
Showing 19 changed files with 39 additions and 38 deletions.
9 changes: 5 additions & 4 deletions main/src/main/scala/sbt/Defaults.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions main/src/main/scala/sbt/Keys.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions sbt-app/src/sbt-test/tests/fork-parallel/test
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Note: this test is meaningless on less than four cores

> test
> testFull
-> check
> clean
> set testForkedParallel := true
> test
> testFull
> check
Original file line number Diff line number Diff line change
Expand Up @@ -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
))
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
> test
> set concurrentRestrictions in Global := Seq(Tags.limitAll(4))
> testFull
> set Global / concurrentRestrictions := Seq(Tags.limitAll(4))
> testFailure
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ inConfig(Test)(Seq(
)
))}
},
TaskKey[Unit]("test-failure") := test.failure.value
TaskKey[Unit]("test-failure") := testFull.failure.value
))
4 changes: 2 additions & 2 deletions sbt-app/src/sbt-test/tests/fork-test-group-parallel/test
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
> testFailure
> set concurrentRestrictions in Global += Tags.limit(Tags.ForkedTestGroup, 1)
> test
> set Global / concurrentRestrictions += Tags.limit(Tags.ForkedTestGroup, 1)
> testFull
3 changes: 1 addition & 2 deletions sbt-app/src/sbt-test/tests/fork2/build.sbt
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions sbt-app/src/sbt-test/tests/fork2/test
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions sbt-app/src/sbt-test/tests/junit-xml-report/test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-> test
-> testFull
> checkReport

# there might be discrepancies between the 'normal' and the 'forked' mode
Expand All @@ -7,5 +7,5 @@
> checkNoReport

> set Test / fork := true
-> test
> checkReport
-> testFull
> checkReport
2 changes: 1 addition & 1 deletion sbt-app/src/sbt-test/tests/nested-inproc-seq/test
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

> clean

> test
> testFull

$ exists target/SuiteStarting-NestedSpecs

Expand Down
2 changes: 1 addition & 1 deletion sbt-app/src/sbt-test/tests/nested-subproc/test
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

> clean

> test
> testFull

$ exists target/SuiteStarting-NestedSpecs

Expand Down
8 changes: 4 additions & 4 deletions sbt-app/src/sbt-test/tests/setup-cleanup/test
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sbt-app/src/sbt-test/tests/single-runner/build.sbt
Original file line number Diff line number Diff line change
@@ -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")
2 changes: 1 addition & 1 deletion sbt-app/src/sbt-test/tests/single-runner/test
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

> clean

> test
> testFull

$ exists target/RunStarting

Expand Down
8 changes: 4 additions & 4 deletions sbt-app/src/sbt-test/tests/specs-run/test
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion sbt-app/src/sbt-test/tests/task/build.sbt
Original file line number Diff line number Diff line change
@@ -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")
2 changes: 1 addition & 1 deletion sbt-app/src/sbt-test/tests/task/test
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

> clean

> test
> testFull

$ exists target/SuiteStarting-TestSpec

Expand Down

0 comments on commit 2a3ea08

Please sign in to comment.