File tree Expand file tree Collapse file tree 3 files changed +11
-36
lines changed
jsdom-nodejs-env/src/test/scala/org/scalajs/jsenv/jsdomnodejs Expand file tree Collapse file tree 3 files changed +11
-36
lines changed Original file line number Diff line number Diff line change 11package org .scalajs .jsenv .jsdomnodejs
22
3- import scala .concurrent .Await
3+ import scala .concurrent .duration . _
44
55import org .junit .Test
66
7- import org .scalajs .io ._
8-
9- import org .scalajs .jsenv ._
7+ import org .scalajs .jsenv .test .kit .TestKit
108
119class JSDOMNodeJSEnvTest {
12-
13- private val TestRunConfig = {
14- RunConfig ()
15- .withInheritOut(false )
16- .withOnOutputStream((_, _) => ()) // ignore stdout
17- }
18-
19- private val config = JSDOMNodeJSSuite .Config
10+ private val kit = new TestKit (new JSDOMNodeJSEnv , 1 .minute)
2011
2112 @ Test
22- def historyAPIWithoutTestKit : Unit = {
23- assertRunSucceeds (
13+ def historyAPI : Unit = {
14+ kit.withRun (
2415 """
2516 |console.log(window.location.href);
2617 |window.history.pushState({}, "", "/foo");
2718 |console.log(window.location.href);
28- """ .stripMargin)
29- }
30-
31- private def assertRunSucceeds (inputStr : String ): Unit = {
32- val inputFile = MemVirtualBinaryFile .fromStringUTF8(" test.js" , inputStr)
33- val input = Input .ScriptsToLoad (List (inputFile))
34- val run = config.jsEnv.start(input, TestRunConfig )
35- try {
36- Await .result(run.future, config.awaitTimeout)
37- } finally {
38- run.close()
19+ """ .stripMargin) {
20+ _.expectOut(" http://localhost/\n " )
21+ .expectOut(" http://localhost/foo\n " )
3922 }
4023 }
41-
4224}
Original file line number Diff line number Diff line change @@ -5,11 +5,4 @@ import org.scalajs.jsenv.test._
55import org .junit .runner .RunWith
66
77@ RunWith (classOf [JSEnvSuiteRunner ])
8- class JSDOMNodeJSSuite extends JSEnvSuite (JSDOMNodeJSSuite .Config )
9-
10- object JSDOMNodeJSSuite {
11- val Config = {
12- JSEnvSuiteConfig (new JSDOMNodeJSEnv )
13- .withTerminateVMJSCode(" __ScalaJSEnv.exitFunction(0)" )
14- }
15- }
8+ class JSDOMNodeJSSuite extends JSEnvSuite (JSEnvSuiteConfig (new JSDOMNodeJSEnv ))
Original file line number Diff line number Diff line change 1- addSbtPlugin(" org.scala-js" % " sbt-scalajs" % " 1.0.0-M5 " )
1+ addSbtPlugin(" org.scala-js" % " sbt-scalajs" % " 1.0.0-M6 " )
22
3- libraryDependencies += " org.scala-js" %% " scalajs-env-nodejs" % " 1.0.0-M5 "
3+ libraryDependencies += " org.scala-js" %% " scalajs-env-nodejs" % " 1.0.0-M6 "
44
55unmanagedSourceDirectories in Compile +=
66 baseDirectory.value.getParentFile / " jsdom-nodejs-env/src/main/scala"
You can’t perform that action at this time.
0 commit comments