Closed xcthulhu closed 8 years ago
That poster to the ClojureScript mailing list is pretty clever BTW :D
It's not out of scope but it is not in the near future either. I implemented a bunch of functionality for browser testing and there are many corner cases to handle yet. After that I might consider implementing this and other new features. In the meantime, PRs are very welcome.
As for the implementations, in the google groups post I offered two but I only see place in doo
for something similar to the second one: initializing a server, calling the cljs tests, and then stopping the server.
I did a trial with doo
and your other project, cljs-react-test
, by using doo/run-script
in a clojure.test
for which I have fixture that spins up&down my server (Stuart Sierra's component makes handling dependencies easy). Before the test I compile CLJS files with a specific runner that selects only e2e style tests.
Had to setup CORS (since the runner takes a local file) to make AJAX work, but that was relatively easy too (using Duct here).
Anyhow, I kinda liked the experiment (also doo
and cljs-react-test
:)) and just saying that doo
as a library might give you enough control to wire things together in a "normal" unit test :)
Thanks @viesti! That's great news. Looking at the code, I agree it can be done using doo.core/run-script
without much fuzz. Maybe there is a way to extract the boiler plate from that so that doo makes it even easier and people start doing it. Otherwise, we can properly document your findings in a tutorial.
Thanks! :) I'm thinking that a short tutorial might be good (or a mention in the readme if this get's short enough) since the wiring might be a bit related to the app architecture. There are at least these points:
doo/run-script
(this is generic, clojure.test is a good starting point)So had sort of a flow (and kids sleeping too :)) and wipped up a "tutorial" in a PR: https://github.com/bensu/doo/pull/65. Hope it makes any sense :)
@xcthulhu did you find the wiki article useful?
@bensu TBH the wiki article is overly complicated. It never really says what my-app.system
is... I take it it's just taken from some project. I've yet to translate this into my own stack.
@xcthulhu I edited the wiki to have a slower pace and explained a few of the requirements. Closing this for now.
Would it be at all possible for
doo
to make client-server integration testing more convenient, or is that out of scope?It looks like the way to do it in
lein
is to have an alias where you spin up a ring server, run your tests, and spin the ring server back down: https://groups.google.com/d/msg/clojurescript/rArkEBCRods/Bqo4IE5ehNUJAnyhow this is a marvelous library and I am looking forward to using it in all of my ClojureScript projects!