Skip to content

Instantly share code, notes, and snippets.

@yayitswei
Forked from anonymous/gist:4665812
Created January 29, 2013 17:04
Show Gist options
  • Save yayitswei/4665835 to your computer and use it in GitHub Desktop.
Save yayitswei/4665835 to your computer and use it in GitHub Desktop.
(ns versaltest.core-test
(:require [cemerick.yonder :as yonder]
[clojure.java.browse :refer (browse-url)]
[compojure.handler :as handler]
[ring.adapter.jetty :as jetty]
[cljs.repl.browser]
[cljs.closure :as closure]
[clojure.tools.nrepl :as nrepl]
(clojure.tools.nrepl [server :as server]))
(:use clojure.test
versaltest.core))
(defn prepare-cljs-browser
([session]
(eval session (cemerick.piggieback/cljs-repl
:repl-env (doto (cljs.repl.browser/repl-env :port 9000)
cljs.repl/-setup)))
(browse-url "http://localhost:8080/test.html")
session))
(deftest browser-test
(let [http (ring.adapter.jetty/run-jetty site
{:port 8080 :join? false})
session (yonder/prep-session
{:prepare prepare-cljs-browser
:new-server
{:handler (clojure.tools.nrepl.server/default-handler
#'cemerick.piggieback/wrap-cljs-repl)}})]
(is (= 6 (yonder/eval session (+ 1 2 3))))
(yonder/eval session (.run js/mocha))
(Thread/sleep 2000)
(is (= 1 @answers))))
Uncaught exception, not in assertion.
expected: nil
actual: java.lang.IllegalStateException: Can't change/establish root binding of: *cljs-repl-options* with set
at clojure.lang.Var.set (Var.java:233)
cemerick.piggieback$cljs_repl.doInvoke (piggieback.clj:140)
clojure.lang.RestFn.invoke (RestFn.java:421)
versaltest.core_test$prepare_cljs_browser.invoke (core_test.clj:16)
cemerick.yonder$prep_session.invoke (yonder.clj:58)
versaltest.core_test/fn (core_test.clj:27)
clojure.test$test_var$fn__6926.invoke (test.clj:701)
clojure.test$test_var.invoke (test.clj:701)
user$eval75$test_var_with_selector__84.invoke (NO_SOURCE_FILE:1)
clojure.lang.AFn.applyToHelper (AFn.java:163)
clojure.lang.AFn.applyTo (AFn.java:151)
clojure.core$apply.invoke (core.clj:603)
leiningen.core.injected$compose_hooks$fn__11.doInvoke (NO_SOURCE_FILE:1)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invoke (core.clj:601)
leiningen.core.injected$run_hooks.invoke (NO_SOURCE_FILE:1)
leiningen.core.injected$prepare_for_hooks$fn__16$fn__17.doInvoke (NO_SOURCE_FILE:1)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.lang.AFunction$1.doInvoke (AFunction.java:29)
clojure.lang.RestFn.invoke (RestFn.java:408)
clojure.test$test_all_vars$fn__6930$fn__6937.invoke (test.clj:717)
clojure.test$default_fixture.invoke (test.clj:671)
clojure.test$test_all_vars$fn__6930.invoke (test.clj:717)
clojure.test$default_fixture.invoke (test.clj:671)
clojure.test$test_all_vars.invoke (test.clj:713)
clojure.test$test_ns.invoke (test.clj:736)
clojure.core$map$fn__4087.invoke (core.clj:2434)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:60)
clojure.lang.Cons.next (Cons.java:39)
clojure.lang.RT.boundedLength (RT.java:1633)
clojure.lang.RestFn.applyTo (RestFn.java:130)
clojure.core$apply.invoke (core.clj:603)
clojure.test$run_tests.doInvoke (test.clj:751)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invoke (core.clj:601)
user$eval75$fn__138.invoke (NO_SOURCE_FILE:1)
user$eval75.invoke (NO_SOURCE_FILE:1)
clojure.lang.Compiler.eval (Compiler.java:6511)
clojure.lang.Compiler.eval (Compiler.java:6501)
clojure.lang.Compiler.eval (Compiler.java:6477)
clojure.core$eval.invoke (core.clj:2797)
clojure.main$eval_opt.invoke (main.clj:297)
clojure.main$initialize.invoke (main.clj:316)
clojure.main$null_opt.invoke (main.clj:349)
clojure.main$main.doInvoke (main.clj:427)
clojure.lang.RestFn.invoke (RestFn.java:421)
clojure.lang.Var.invoke (Var.java:419)
clojure.lang.AFn.applyToHelper (AFn.java:163)
clojure.lang.Var.applyTo (Var.java:532)
clojure.main.main (main.java:37)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment