Skip to content

Commit

Permalink
testkit: build against ScalaTest 3.2
Browse files Browse the repository at this point in the history
This is a breaking change for testkit users that were relying on
the ScalaTest 3.0 package hierarchy, deprecated 3 years ago in 3.1
and removed in 3.2 (despite no major bump).

Scalafix rules were made available to ease that transition, see
https://github.com/scalatest/autofix/tree/master.
  • Loading branch information
bjaglin committed Apr 16, 2023
1 parent 87fb44f commit c903c63
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 18 deletions.
3 changes: 0 additions & 3 deletions .scala-steward.conf
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
pullRequests.frequency = "0 0 1,15 * ?"
updates.pin = [
# don't bump, to avoid forcing breaking changes on clients via eviction
{ groupId = "org.scalatest", artifactId = "scalatest", version = "3.0.8" },

# JGit 6.x requires Java 11, see https://www.eclipse.org/lists/cross-project-issues-dev/msg18654.html
{ groupId = "org.eclipse.jgit", artifactId = "org.eclipse.jgit", version = "5." },

Expand Down
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ lazy val testkit = projectMatrix
moduleName := "scalafix-testkit",
isFullCrossVersion,
libraryDependencies += googleDiff,
libraryDependencies += scalatestDep.value
libraryDependencies += scalatest
)
.defaultAxes(VirtualAxis.jvm)
.jvmPlatform(buildScalaVersions)
Expand All @@ -224,7 +224,7 @@ lazy val unit = projectMatrix
libraryDependencies ++= List(
jgit,
munit,
scalatest.withRevision(scalatestLatestV)
scalatest
),
libraryDependencies ++= {
if (!isScala3.value) {
Expand Down
5 changes: 2 additions & 3 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ object Dependencies {
val nailgunV = "0.9.1"
val scalaXmlV = "2.1.0"
val scalametaV = "4.7.6"
val scalatestMinV = "3.0.8" // don't bump, to avoid forcing breaking changes on clients via eviction
val scalatestLatestV = "3.2.13"
val scalatestV = "3.2.13"
val munitV = "0.7.29"

val bijectionCore = "com.twitter" %% "bijection-core" % bijectionCoreV
Expand All @@ -55,7 +54,7 @@ object Dependencies {
.cross(CrossVersion.for3Use2_13)
val scalametaTeskit = ("org.scalameta" %% "testkit" % scalametaV)
.cross(CrossVersion.for3Use2_13)
val scalatest = "org.scalatest" %% "scalatest" % scalatestMinV
val scalatest = "org.scalatest" %% "scalatest" % scalatestV
val munit = "org.scalameta" %% "munit" % munitV
val semanticdbScalacCore = "org.scalameta" % "semanticdb-scalac-core" % scalametaV cross CrossVersion.full

Expand Down
6 changes: 1 addition & 5 deletions project/ScalafixBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
buildInfoObject := "RulesBuildInfo"
)

lazy val scalatestDep = Def.setting {
if (isScala3.value) scalatest.withRevision(scalatestLatestV)
else scalatest
}
}

import autoImport._
Expand Down Expand Up @@ -211,7 +207,7 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
// don't publish scala 3 artifacts for now
publish / skip := (if ((publish / skip).value) true
else scalaBinaryVersion.value == "3"),
versionPolicyIntention := Compatibility.BinaryCompatible,
versionPolicyIntention := Compatibility.None,
scalacOptions ++= compilerOptions.value,
scalacOptions ++= semanticdbSyntheticsCompilerOption.value,
Compile / console / scalacOptions :=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import scalafix.internal.v1.Args

/**
* Construct a test suite for running semantic Scalafix rules. <p> Mix-in
* FunSuiteLike (ScalaTest 3.0), AnyFunSuiteLike (ScalaTest 3.1+) or the testing
* style of your choice if you add your own tests.
* AnyFunSuiteLike or the testing style of your choice if you add your own
* tests.
*/
abstract class AbstractSemanticRuleSuite(
val props: TestkitProperties,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ import scalafix.syntax._
import scalafix.v1._

/**
* Utility to unit test syntactic rules. <p> Mix-in FunSuiteLike (ScalaTest
* 3.0), AnyFunSuiteLike (ScalaTest 3.1+) or the testing style of your choice if
* you add your own tests.
* Utility to unit test syntactic rules. <p> Mix-in AnyFunSuiteLike or the
* testing style of your choice if you add your own tests.
*
* @param rule
* the default rule to use from `check`/`checkDiff`.
Expand Down

0 comments on commit c903c63

Please sign in to comment.