1

I am following the Basic Tutorial over at Scala.JS. I've also followed Cannot get uTest to see my tests

I update my build.sbt to have the following:

testFrameworks += new TestFramework("utest.runner.Framework")
libraryDependencies += "com.lihaoyi" %%% "utest" % "0.3.0" % "test"

I have created

src/test/scala/tutorial/webapp/TutorialTest.scala

package tutorial.webapp

import utest._
import org.scalajs.jquery.jQuery

object TutorialTest extends TestSuite {

  // Initialize App
  TutorialApp.setupUI()

  def tests = TestSuite {
    'HelloWorld {
      assert(jQuery("p:contains('Hello World')").length == 1)
    }
  }
}

I reload sbt, then type 'test', but I always get the following error:

[error] MyProject/src/main/scala/tutorial/webapp/TutorialTest.scala:3: not found: object utest [error] import utest._

If I remove the tail {% "test"} from my build.sbt, I'm able to run the 'test' command from sbt but it doesn't pick up my tests.

I hope I'm making sense here, this error has stumped me.

Community
  • 1
  • 1
Tom K
  • 145
  • 1
  • 13

1 Answers1

2

The error message shows that you have TutorialTest.scala under src/main. It should be under src/test. (Perhaps you accidentally put it in both places?)

Test dependencies (such as utest) are only on the classpath when compiling test sources — hence the error.

Seth Tisue
  • 29,985
  • 11
  • 82
  • 149
  • Perfect! I must've missed the part of the tutorial that told me to create the file under src/test and *not* src/main :-s – Tom K Dec 01 '15 at 01:01