I have a nice setup for CLJS testing using the `doo` test framework. It
can run tests either at the command line using `phantomjs` or in the
browser (eg Chrome). It has source and test dirs segregrated into `clj`,
`cljc`, and `cljs` subdirs so you can get macros and dual-use code working
correctly. You can see it here:
https://github.com/cloojure/cljs-template
A sample run:
~/expr/cljs-template > lein clean ; time lein doo phantom test once
;; ======================================================================
;; Testing with Phantom:
doorunner - beginning
doorunner - end
Testing tst.flintstones.dino
test once - enter
globalObject: #js {:a 1, :b 2, :c 3}
(-> % .-b (+ 5) => 7
(js/makeDino) => #js {:desc blue dino-dog, :says #object[Function]}
dino.desc => blue dino-dog
dino.says(5) => Ruff-Ruff-Ruff-Ruff-Ruff!
:keep-words ("am" "having" "today")
:re-seq ("am" "having" "today")
test once - leave
Testing tst.flintstones.wilma
test each - enter
test each - leave
test each - enter
wilmaPhony/stats: #js {:lipstick red, :height 5.5}
wilma => #js {:desc patient housewife, :says #object[Function]}
test each - leave
Testing tst.flintstones.pebbles
test once - enter
test once - leave
Testing tst.flintstones.slate
logr-slate-enter
logr-slate-leave 3
Testing tst.flintstones.bambam
test each - enter
test each - leave
test each - enter
logr-bambam-enter
logr-bambam-leave 3
test each - leave
Ran 9 tests containing 22 assertions.
0 failures, 0 errors.
lein doo phantom test once 38.52s user 0.84s system 333% cpu 11.813 total
On Fri, Nov 9, 2018 at 10:14 AM Gareth James <[email protected]> wrote:
> I'm currently researching different methods for testing clojurescipt code,
> specifically unit testing, automated browser testing and code coverage. I'm
> specifically trying to find more information about the use of cljs.test and
> cljs.spec either individually or together. Could anyone share any
> experience they have of using either of these or any other information
> about how they are testing their code.
>
> Thanks
> Gareth
>
> --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to the Google Groups
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/clojurescript.
>
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/clojurescript.