Skip to content
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

Add support for cljs test #65

Open
zerg000000 opened this issue Aug 16, 2017 · 0 comments
Open

Add support for cljs test #65

zerg000000 opened this issue Aug 16, 2017 · 0 comments

Comments

@zerg000000
Copy link

zerg000000 commented Aug 16, 2017

Currently seems no ways to run cljs test or trigger cljs test from repl. Here is my first attempt to add cljs to duct. Any thoughts on this topic? one drawback is the cljs need to compile using (reset) before cljs-test

project.clj

...
:profiles {
  :project/dev { ...
    :dependencies [...
     [doo "0.1.7"]]}
}
...

dev/resources/dev.edn

{:duct.core/environment :development
 :duct.core/include ["ns-project/config"]
 :duct.server/figwheel
 {:builds [...
           {:id           "test"
            :source-paths ["src" "test"]
            :build-options
            {:main       ns-test.runner
             :output-to  "target/out/test.js"
             :optimizations :none
             :process-shim false}}]}}

dev/src/dev.clj

...
(defn cljs-test []
  (let [doo-opts {:paths {:phantom "phantomjs --web-security=false"}}
        compiler-opts {:main 'ns-test.runner
                       :output-to "target/out/test.js"
                       :optimizations :none
                       :process-shim false}]
    (doo/run-script :phantom compiler-opts doo-opts)))
...

test/ns-test/runner.cljs

(ns ns-project.runner
  (:require [doo.runner :refer-macros [doo-tests]]
            [ns-project.text-test]))

(doo-tests 'ns-project.text-test)

REPL

=> (reset) (cljs-test)
...
=> :resumed

Testing ns-project.text-test

Ran 3 tests containing 4 assertions.
0 failures, 0 errors.
=> {:exit 0, :out "Testing ns-project.text-testRan 3 tests containing 4 assertions.0 failures, 0 errors.", :err ""}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant