Trying to work out the best option for testing lib that works across both clj+cljs and works with reader conditionals. I was previously using midje, but finding it a bit flaky with the newer clojure versions - thinking about just shifting to clojure/cljs.test - unless anyone has any other suggestions?
@markmandel: haven't yet put it through its paces, but speclj appears to be closer to the BDD spirit of midje https://github.com/slagyr/speclj
Yeah, speclj also has specljs... I was wondering about that
Wondering how well it handles .cljc files
it's on my radar specifically because it mentions cljs as supported (i've worked in clj but only starting to work in cljs), but bonus it uses rspec-ish semantics
Looks like there are some issues: https://github.com/slagyr/speclj/issues/133
And this library is a library that can work from clj and cljs.. so having tests that can be cljc is pretty important
honestly, and granted i'm new to cljs (as in, days), but i've found cljc fiddly at best
I was using cljx before, which was generative, so it was less of an issue
Yeah, that was why my thought was just go back to clojure/cljs.test - keep it super simple
i found clojure.test basically intolerable. best of luck if that's what you end up with
What did you hate about it?
well, i'm a BDD partisan. so...
Ah, I'm not as fussed - as long as I can write tests
i find the form (deftest somebadnamewithpoorformating assert-things-that-dont-express-what-i-want-to-ensure)
a poor recipe for good testing
but again, partisan
I see your point - but I can't have a testing library that just doesn't work with reader conditionals.
That's just the biggest thing
so, my inclination (again days in) is to strictly separate clj and cljs. i think testing those will prove simpler (even if i end up needing different testing environments, which i don't know)
I'll have a massive amount of repetition then
that's not a good thing
are you working on something isomorphic?
how much work is actually expected to be done, and done the same way, client and server?
so it's a game framework library, and sometimes people write games in clj and sometimes they write them in cljs
it's more of a game architecture library (entity system components)
gotcha
so there isn't a huge amount that needs to switch between the two implementations - but there are things
that definitely falls outside the use cases i've been researching for
https://github.com/markmandel/brute < library in question
`
dammit slack
#+clj (java.util.UUID/randomUUID)
#+cljs
(let [template "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
hehe
interop is fun. it's surprising how little i've needed to think of it either on the JVM or JS
Yeah, it's those little small pieces that needs to switch
I think I'll take a stab at this test suite that is failing with midje (no idea why really, magic macros are failing with cljc I think), to clojure.test, and see how it feels
It's not such a huge test suite that I can't pick it up and move it again to something else
good luck
midje is all magic, i always feared i'd hit a black box with it
Plus, in theory it should be better tested for this type of scenario
the type of scenario where the testing framework isn't suited to multiple host envs?
:simple_smile:
Every time I look at a testing library, I see issues with reader conitionals
pretty much
obviously much more difficult, but i'd like a multi-host language to be able to handle that, as much as possible
(more than that i'd prefer a self-hosted language, buuuuut)
One thing at a time? 😉
TIme to go to bed and dream about lisp :simple_smile: thanks for the sounding board.
cheers
@markmandel: have a look at Expectations. Uses cljx right now but at least it does both clj and cljs
Jay Fields has always been very responsive to our feedback so I would expect him to be receptive to moving to cljc if that's an obstacle...
@seancorfield So expectations looks interesting, but there is zero mentions of cljs support on the website and/or how to get up and running with it in cljs, which makes me hesitant to adopt it.
Is there somewhere a good tutorial or book how to learn to make tests with clojure
I am just a humble beginner in clojure. But coming from a Java background I would say test.check knocked my socks off when it came to writing tests.
@roelof: clojure-cookbook has a chapter on testing that is a good start. https://github.com/clojure-cookbook/clojure-cookbook other than that, the book clojure applied has good stuff on testing as well. http://www.amazon.com/Clojure-Applied-Practitioner-Ben-Vandgrift/dp/1680500740/ref=sr_1_1?ie=UTF8&qid=1448562345&sr=8-1&keywords=clojure+applied
@twillis: any book you recommend for a beginner.
@roelof: this is a great beginners book http://www.braveclojure.com/
also Living Clojure is explicitly targeting beginners
the author of Living Clojure discusses her book in this podcast http://blog.cognitect.com/cognicast/088
yep those
I have read braveclojure
I mean with my question which one book twillis mentioned is better for a beginner
Neither, really.
oke, I will continue reading brave and I hope when I ends that book , One of the books can be the next one
Having skimmed through both of those books I'd say the cookbook might be more approachable. Clojure Applied is awesome but it has some more advanced material in it.
They're both very practical books.
My other strong recommendation is Emerick's Clojure Programming on O'Reilly.
Thanks all.
@seancorfield: I had it all because of a question earlier about a state question for a toy project which I have in mind
I call it a day, Going watching tv and then I hope I sleep well. Tomorrow and Saterday very busy days