├── scripts ├── brepl ├── repl ├── compile_cljsc ├── repl.clj └── brepl.clj ├── src └── hello │ └── core.cljs ├── test └── hello │ ├── core_test.cljs │ └── test.cljs ├── .gitignore ├── README.md └── project.clj /scripts/brepl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | rlwrap lein trampoline run -m clojure.main scripts/brepl.clj 3 | -------------------------------------------------------------------------------- /scripts/repl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | rlwrap lein trampoline run -m clojure.main scripts/repl.clj 3 | -------------------------------------------------------------------------------- /src/hello/core.cljs: -------------------------------------------------------------------------------- 1 | (ns hello.core 2 | #_(:require [clojure.browser.repl :as repl])) 3 | 4 | ;; (repl/connect "http://localhost:9000/repl") 5 | 6 | -------------------------------------------------------------------------------- /scripts/compile_cljsc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | lein trampoline run -m clojure.main -e "(compile 'cljs.repl.node) (compile 'cljs.repl.browser) (compile 'cljs.core)" 3 | -------------------------------------------------------------------------------- /test/hello/core_test.cljs: -------------------------------------------------------------------------------- 1 | (ns hello.core-test 2 | (:require [expectations :refer-macros [expect 3 | expect-focused]])) 4 | 5 | (expect 1 1) 6 | 7 | (expect js/Error (throw (js/Error. "Hi!"))) -------------------------------------------------------------------------------- /scripts/repl.clj: -------------------------------------------------------------------------------- 1 | (require 2 | '[cljs.repl :as repl] 3 | '[cljs.repl.node :as node]) 4 | 5 | (repl/repl* (node/repl-env) 6 | {:output-dir "out" 7 | :optimizations :none 8 | :cache-analysis true 9 | :source-map true}) 10 | -------------------------------------------------------------------------------- /scripts/brepl.clj: -------------------------------------------------------------------------------- 1 | (require 2 | '[cljs.repl :as repl] 3 | '[cljs.repl.browser :as browser]) 4 | 5 | (repl/repl* (browser/repl-env) 6 | {:output-dir "out" 7 | :optimizations :none 8 | :cache-analysis true 9 | :source-map true}) 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /classes 3 | /checkouts 4 | pom.xml 5 | pom.xml.asc 6 | *.jar 7 | *.class 8 | /lib 9 | /out 10 | /out-adv 11 | .fig 12 | /*nrepl-server* 13 | /repl-port 14 | /.lein-* 15 | /.nrepl-port 16 | /node_modules 17 | /*-init.clj 18 | /.idea 19 | *.iml 20 | -------------------------------------------------------------------------------- /test/hello/test.cljs: -------------------------------------------------------------------------------- 1 | (ns hello.test 2 | (:require-macros [expectations.cljs :as ecljs]) 3 | (:require [expectations] 4 | [hello.core-test])) 5 | 6 | (defn -main [] 7 | (println "Hello Expectations!") 8 | (ecljs/run-all-tests)) 9 | 10 | (enable-console-print!) 11 | (set! *main-cli-fn* -main) 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # expectations-hello-cljs 2 | 3 | Sample ClojureScript project for Expectations testing framework. Enjoy! 4 | 5 | ## Setup 6 | 7 | First-time Clojurescript developers, add the following to your bash .profile: 8 | 9 | export LEIN_FAST_TRAMPOLINE=y 10 | alias cljsbuild="lein trampoline cljsbuild $@" 11 | 12 | To avoid compiling ClojureScript for each build, AOT Clojurescript locally in your project with the following: 13 | 14 | ./scripts/compile_cljsc 15 | 16 | Subsequent dev builds can use: 17 | 18 | lein cljsbuild auto test 19 | 20 | To start a Node REPL (requires rlwrap): 21 | 22 | ./scripts/repl 23 | 24 | To get source map support in the Node REPL: 25 | 26 | lein npm install 27 | 28 | Clean project specific out: 29 | 30 | lein clean 31 | 32 | Optimized builds: 33 | 34 | lein cljsbuild once release 35 | 36 | 37 | ## License 38 | 39 | Copyright © 2014 Ivan Mikushin 40 | 41 | Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version. 42 | -------------------------------------------------------------------------------- /project.clj: -------------------------------------------------------------------------------- 1 | (defproject expectations-hello-cljs "0.1.0-SNAPSHOT" 2 | :description "FIXME: write this!" 3 | :url "http://example.com/FIXME" 4 | 5 | :dependencies [[org.clojure/clojure "1.6.0"] 6 | [org.clojure/clojurescript "0.0-2913"]] 7 | 8 | :profiles {:dev {:dependencies [[expectations "2.1.0-SNAPSHOT"]]}} 9 | 10 | :node-dependencies [[source-map-support "^0.2.9"]] 11 | 12 | :plugins [[lein-cljsbuild "1.0.5"] 13 | [lein-npm "0.5.0"]] 14 | 15 | :source-paths ["src" "target/classes"] 16 | 17 | :clean-targets ["out" "out-adv"] 18 | 19 | :cljsbuild {:builds [{:id "test" 20 | :source-paths ["src" "test"] 21 | :notify-command ["node" "./out/test.js"] 22 | :compiler {:target :nodejs 23 | :main hello.test 24 | :output-to "out/test.js" 25 | :output-dir "out" 26 | :optimizations :none 27 | :cache-analysis true 28 | :source-map true}} 29 | {:id "release" 30 | :source-paths ["src"] 31 | :compiler {:main hello.core 32 | :output-to "out-adv/hello.min.js" 33 | :output-dir "out-adv" 34 | :optimizations :advanced 35 | :pretty-print false}}]}) 36 | --------------------------------------------------------------------------------