Help converting scalatest suites to 2.13

I’m trying to convert a project from scala 2.12 to 2.13, and I’m having trouble getting the test suites to load compile.

Here is how I’ve updated my build.sbt file, and I don’t see any library loading problems. Am I using the wrong version of scalatest?

name := "globe"
version := "0.1"

scalaVersion := "2.13.3"
libraryDependencies += "junit" % "junit" % "4.10" % "test"
libraryDependencies += "org.scalactic" %% "scalactic" % "3.2.0"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.0" % "test"
libraryDependencies += "org.scalafx" %% "scalafx" % "14-R19"
libraryDependencies += "org.scala-lang.modules" %% "scala-parallel-collections" % "0.2.0"
// begin
lazy val osName = System.getProperty("os.name") match {
  case n if n.startsWith("Linux") => "linux"
  case n if n.startsWith("Mac") => "mac"
  case n if n.startsWith("Windows") => "win"
  case _ => throw new Exception("Unknown platform!")
}

// Add JavaFX dependencies
lazy val javaFXModules = Seq("base", "controls", "fxml", "graphics", "media", "swing", "web")
libraryDependencies ++= javaFXModules.map( m=>
  "org.openjfx" % s"javafx-$m" % "14.0.1" classifier osName
)
// end
val circeVersion = "0.12.3"

libraryDependencies ++= Seq(
  "io.circe" %% "circe-core",
  "io.circe" %% "circe-generic",
  "io.circe" %% "circe-parser"
  ).map(_ % circeVersion)

org.scalatest.FunSuite is org.scalatest.funsuite.AnyFunSuite as of 3.2.0, and there’s more renamings and other breaking changes, see the release notes - also for previous versions, depending on where you upgraded from.

4 Likes

works like a charm. thanks.

Consider scalafix for ScalaTest which automatically rewrites the deprecated symbols. For example, the following seems to work on my machine

project/plugins.sbt

addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.17")

build.sbt

ThisBuild / scalaVersion := "2.13.2"
ThisBuild / scalafixDependencies += "org.scalatest" %% "autofix" % "3.1.0.0"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.1.0" % Test
addCompilerPlugin(scalafixSemanticdb)

and then

test:scalafix RewriteDeprecatedNames
3 Likes