Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I getting this error when running Scala 2.13 tests in IntelliJ, but not with Scala 2.12?

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?

like image 923
GreenSaguaro Avatar asked Jun 18 '19 08:06

GreenSaguaro


1 Answers

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
like image 83
Mario Galic Avatar answered Sep 27 '22 20:09

Mario Galic