1

When running

sbt compile

in project root I get error:

object junit is not a member of package org
[error] import org.junit.Test

I have fully defined build.sbt:

libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test"
testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v")
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % "test
libraryDependencies += "junit" % "junit" % "4.12" % "test"

File TestSingleLinkedList.scala is also in project root and has:

import org.junit.Test
Draif Kroneg
  • 743
  • 13
  • 34

1 Answers1

1

It seems the only valid to put junit tests in sbt is:

├── built.sbt
├── src
│   └── test
│       └── scala
│           ├── X.scala

Otherwise - sbt will provide very uninformative and confusing error about junit not being included. I found the answer from ScalaTest on sbt not running any tests where someone asked different question about sbt not running the tests. In my case the sbt - was not compiling at all.

Dmytro Mitin
  • 48,194
  • 3
  • 28
  • 66
Draif Kroneg
  • 743
  • 13
  • 34