This setup includes the ability to use/test native JS libs in 3 different ways, which required a bit of a struggle (i.e. trial & error) to get the syntax right. Here are the native JavaScript files in ~/resources:
~/expr/cljs-template > tree resources resources └── public ├── css │ └── style.css ├── dino-externs.js ├── dino.js ├── index.html ├── js ├── libs │ └── wilma.js └── pebbles.js On Fri, Nov 9, 2018 at 2:18 PM Alan Thompson <clooj...@gmail.com> wrote: > You can see the source layout as follows: > > ~/expr/cljs-template > tree src test > src > ├── clj > │ └── flintstones > │ └── test_clj.clj > ├── cljc > │ └── flintstones > │ ├── bambam.cljc > │ ├── core.cljc > │ ├── slate.cljc > │ └── test_cljs.cljc > └── cljs > └── flintstones > └── test_cljs.cljs > test > ├── clj > ├── cljc > │ └── tst > │ └── flintstones > │ ├── bambam.cljc > │ └── slate.cljc > └── cljs > └── tst > └── flintstones > ├── dino.cljs > ├── doorunner.cljs > ├── pebbles.cljs > └── wilma.cljs > > 13 directories, 12 files > > > > > > On Fri, Nov 9, 2018 at 2:17 PM Alan Thompson <clooj...@gmail.com> wrote: > >> 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 <garet...@gmail.com> 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 clojurescript+unsubscr...@googlegroups.com. >>> To post to this group, send email to clojurescript@googlegroups.com. >>> 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 clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript.