18

I am getting the following error when I try to run tests in IntelliJ (2019.1), Scala IntelliJ plugin v2019.1.8, with Scala 2.13:

Exception in thread "ScalaTest-dispatcher" java.lang.NoSuchMethodError: scala.collection.JavaConverters.seqAsJavaListConverter(Lscala/collection/Seq;)Lscala/collection/convert/Decorators$AsJava;
    at org.jetbrains.plugins.scala.testingSupport.scalaTest.treeBuilder.ParallelTreeBuilder.getOrdinalList(ParallelTreeBuilder.java:21)
    at org.jetbrains.plugins.scala.testingSupport.scalaTest.treeBuilder.ParallelTreeBuilder$SuiteTree.<init>(ParallelTreeBuilder.java:92)
    at org.jetbrains.plugins.scala.testingSupport.scalaTest.treeBuilder.ParallelTreeBuilder.initRun(ParallelTreeBuilder.java:261)
    at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestReporterWithLocation.apply(ScalaTestReporterWithLocation.java:59)
    at org.scalatest.DispatchReporter$Propagator.$anonfun$run$10(DispatchReporter.scala:249)
    at org.scalatest.DispatchReporter$Propagator.$anonfun$run$10$adapted(DispatchReporter.scala:248)
    at scala.collection.immutable.List.foreach(List.scala:312)
    at org.scalatest.DispatchReporter$Propagator.run(DispatchReporter.scala:248)
    at java.lang.Thread.run(Thread.java:745)

The following are my Gradle dependencies:

dependencies {
    implementation 'org.scala-lang:scala-library:2.13.0'

    testImplementation 'org.scalatic:scalatic_2.13:3.0.8'
    testImplementation 'org.scalatest:scalatest_2.13:3.0.8'
}

When I change the dependencies to Scala 2.12.x, the tests execute correctly in IntelliJ without error. What is going on here?

Mario Galic
  • 47,285
  • 6
  • 56
  • 98
GreenSaguaro
  • 2,968
  • 2
  • 22
  • 41

1 Answers1

16

Update: This has been fixed in plugin version 2019.1.9.


It is possible IntelliJ Scala plugin needs to be updated for 2.13. Meanwhile try workaround by selecting the checkboxes Use sbt and Use UI with sbt under test's Edit configuration.... According to Dmitrii Naumenko:

This is fixed in the

  • 2019.1 EAP #2019.1.8.21
  • 2019.2 Nightly
  • Will be available soon in 2019.2 EAP and 2019.1 new Release

Regarding Gradle, try configuring to delegate to Gradle Test Runner

  1. Remove exising ScalaTest runners
  2. Go to Build, Execution, Deployment | Build Tools | Gradle | Runner
  3. Select the checkbox Delegate IDE build/run actions to Gradle
  4. Choose Gradle Test Runner
Mario Galic
  • 47,285
  • 6
  • 56
  • 98
  • In my case, I am using Gradle, but I did try selecting build, run, and run tests with Gradle, and it did not work. – GreenSaguaro Jun 21 '19 at 06:06
  • Running tests from the command line has always worked though. – GreenSaguaro Jun 21 '19 at 06:19
  • Does it not work if changing `Run tests using` to `Gradle Test Runner` described here: https://www.jetbrains.com/help/idea/runner.html – Mario Galic Jun 21 '19 at 06:36
  • The first time, I thought I was changing the setting you are referring to, but I was not. I looked again and did find the correct place to make the change. It still did not work though. – GreenSaguaro Jun 21 '19 at 06:47
  • Did you select the checkbox `Delegate IDE build/run actions to Gradle`? – Mario Galic Jun 21 '19 at 10:47
  • I still have this issue using maven and Intellij 2020.1.4, even when I check Delegate IDE build/run actions to maven in maven tab – maxime G Oct 01 '20 at 09:48