Skip to content

Add Scala.js test suite #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion project/ScalaJSBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ object ScalaJSBuild extends Build {
clean := clean.dependsOn(
// compiler, library and sbt-plugin are aggregated
clean in corejslib, clean in javalib, clean in scalalib,
clean in libraryAux, clean in examples,
clean in libraryAux, clean in test, clean in examples,
clean in exampleHelloWorld, clean in exampleReversi).value,

publish := {},
Expand Down Expand Up @@ -256,4 +256,17 @@ object ScalaJSBuild extends Build {
moduleName := "reversi"
)
).dependsOn(compiler % "plugin")

// Testing

lazy val test: Project = Project(
id = "scalajs-test",
base = file("test"),
settings = defaultSettings ++ scalaJSSettings ++ Seq(
name := "Scala.js test suite",
publishArtifact in Compile := false,
scalacOptions += "-Yskip:cleanup,icode,jvm"
)
).dependsOn(compiler % "plugin")

}
25 changes: 25 additions & 0 deletions test/src/test/resources/bootstrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* __ *\
** ________ ___ / / ___ __ ____ Scala.js Test Suite **
** / __/ __// _ | / / / _ | __ / // __/ (c) 2013, Jonas Fonseca **
** __\ \/ /__/ __ |/ /__/ __ |/_// /_\ \ http://scala-js.org/ **
** /____/\___/_/ |_/____/_/ | |__/ /____/ **
** |/____/ **
\* */

/**
* This file is loaded first and used for patching the JS environment.
*/

function scalaJSStub(name) {
return function() {
console.log("Stub for " + name + " called");
}
};

/* Stub-out timer methods used by Jasmine and not provided by Rhino. */
if (typeof setTimeout == 'undefined') {
var setTimeout = scalaJSStub('setTimeout');
var clearTimeout = scalaJSStub('clearTimeout');
var setInterval = scalaJSStub('setInterval');
var clearInterval = scalaJSStub('clearInterval');
}
Loading