Running specs2 test on IntelliJ throws InvocationTargetException

239 views Asked by At

I have Scala Play project which uses specs2 as the test framework. I'm having difficult time running the tests from IntelliJ. I get the following error:

InvocationTargetException for 'main' in org.specs2.NotifierRunner: null


Process finished with exit code 0

The tests run successfully from sbt. I have seen few other posts which says it could be due to ScalaTestPlus, but I don't use ScalaTest.

Here is what my dependencies look like

build.sbt

libraryDependencies ++= Seq(
  ws,
  guice,
  specs2 % Test,
...
)

project/plugins.sbt

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.6")

...

The test looks like following:

@RunWith(classOf[JUnitRunner])
class MyAppSpec extends PlaySpecification with Mockito {
...
1

There are 1 answers

0
Rand Chen On

just leave a comment for someone still struggling, hope it help.

I faced the same error, it cause by i just use a different scala version with specs2. i specific scala binary version as 2.12 but import a specs2 compiled with 2.11.