I have a SBT project that is written in Scala 3. I am attempting to run the tests (written in Scalatest) in debug mode in Intellij.
I have tried a couple different approaches, and thus far, I either get some sort of exception, or the breakpoints aren't being honored.
What I have tried:
- Setting up a Scalatest run configuration (both using sbt and otherwise) in Intellij
- Starting a debug session in sbt in a separate terminal and attempting to attach to it via a Remote JVM Debug
- Starting a session using the sbt Shell in IJ, and attempting to attach (I guess this is really the same as #2, it just eliminates an extra window)
- Setting up an SBT Task configuration in Intellij, and setting the command to
~testOnly
Approach #1 results in the following exception
java.lang.NoClassDefFoundError: org/scalatest/tools/Runner
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2or3(ScalaTestRunner.java:43)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:26)
Caused by: java.lang.ClassNotFoundException: org.scalatest.tools.Runner
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 2 more
Approach #2 and #3 ran the tests, but did not stop at any breakpoints.
Approach #4 hug when trying to build the project.
If it helps, the project consists of several ScalaJS lambdas, with a bunch of tests written in Scalatests.
Has anyone had any success with doing this before?