Skip to content

Commit a9e9056

Browse files
authored
Merge pull request #15 from gzm0/m6
Upgrade to Scala.js 1.0.0-M6
2 parents c711881 + 770e0f6 commit a9e9056

File tree

3 files changed

+11
-36
lines changed

3 files changed

+11
-36
lines changed
Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,24 @@
11
package org.scalajs.jsenv.jsdomnodejs
22

3-
import scala.concurrent.Await
3+
import scala.concurrent.duration._
44

55
import org.junit.Test
66

7-
import org.scalajs.io._
8-
9-
import org.scalajs.jsenv._
7+
import org.scalajs.jsenv.test.kit.TestKit
108

119
class 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
}

jsdom-nodejs-env/src/test/scala/org/scalajs/jsenv/jsdomnodejs/JSDOMNodeJSSuite.scala

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,4 @@ import org.scalajs.jsenv.test._
55
import 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))

project/plugins.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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

55
unmanagedSourceDirectories in Compile +=
66
baseDirectory.value.getParentFile / "jsdom-nodejs-env/src/main/scala"

0 commit comments

Comments
 (0)