Fork me on GitHub
#admin-announcements
<
2015-11-26
>
markmandel06:11:35

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?

eyelidlessness06:11:25

@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

markmandel06:11:44

Yeah, speclj also has specljs... I was wondering about that

markmandel06:11:17

Wondering how well it handles .cljc files

eyelidlessness06:11:34

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

markmandel06:11:54

And this library is a library that can work from clj and cljs.. so having tests that can be cljc is pretty important

eyelidlessness06:11:08

honestly, and granted i'm new to cljs (as in, days), but i've found cljc fiddly at best

markmandel06:11:10

I was using cljx before, which was generative, so it was less of an issue

markmandel06:11:58

Yeah, that was why my thought was just go back to clojure/cljs.test - keep it super simple

eyelidlessness06:11:55

i found clojure.test basically intolerable. best of luck if that's what you end up with

markmandel06:11:21

What did you hate about it?

eyelidlessness06:11:30

well, i'm a BDD partisan. so...

markmandel06:11:44

Ah, I'm not as fussed - as long as I can write tests

eyelidlessness06:11:38

i find the form (deftest somebadnamewithpoorformating assert-things-that-dont-express-what-i-want-to-ensure) a poor recipe for good testing

eyelidlessness06:11:55

but again, partisan

markmandel06:11:25

I see your point - but I can't have a testing library that just doesn't work with reader conditionals.

markmandel06:11:55

That's just the biggest thing

eyelidlessness06:11:46

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)

markmandel06:11:04

I'll have a massive amount of repetition then

markmandel06:11:08

that's not a good thing

eyelidlessness06:11:35

are you working on something isomorphic?

eyelidlessness07:11:11

how much work is actually expected to be done, and done the same way, client and server?

markmandel07:11:25

so it's a game framework library, and sometimes people write games in clj and sometimes they write them in cljs

markmandel07:11:42

it's more of a game architecture library (entity system components)

markmandel07:11:56

so there isn't a huge amount that needs to switch between the two implementations - but there are things

eyelidlessness07:11:49

that definitely falls outside the use cases i've been researching for

eyelidlessness07:11:14

#+clj (java.util.UUID/randomUUID)
  #+cljs
  (let [template "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"

eyelidlessness07:11:41

interop is fun. it's surprising how little i've needed to think of it either on the JVM or JS

markmandel07:11:55

Yeah, it's those little small pieces that needs to switch

markmandel07:11:49

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

markmandel07:11:08

It's not such a huge test suite that I can't pick it up and move it again to something else

eyelidlessness07:11:02

midje is all magic, i always feared i'd hit a black box with it

markmandel07:11:12

Plus, in theory it should be better tested for this type of scenario

eyelidlessness07:11:38

the type of scenario where the testing framework isn't suited to multiple host envs?

markmandel07:11:41

Every time I look at a testing library, I see issues with reader conitionals

eyelidlessness07:11:36

obviously much more difficult, but i'd like a multi-host language to be able to handle that, as much as possible

eyelidlessness07:11:06

(more than that i'd prefer a self-hosted language, buuuuut)

markmandel07:11:00

One thing at a time? 😉

markmandel07:11:55

TIme to go to bed and dream about lisp simple_smile thanks for the sounding board.

seancorfield07:11:50

@markmandel: have a look at Expectations. Uses cljx right now but at least it does both clj and cljs

seancorfield07:11:31

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...

markmandel17:11:52

@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.

roelof18:11:34

Is there somewhere a good tutorial or book how to learn to make tests with clojure

udit18:11:55

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.

roelof18:11:19

@twillis: any book you recommend for a beginner.

roberto18:11:27

also Living Clojure is explicitly targeting beginners

roberto18:11:22

the author of Living Clojure discusses her book in this podcast http://blog.cognitect.com/cognicast/088

roelof19:11:38

I have read braveclojure

roelof19:11:03

I mean with my question which one book twillis mentioned is better for a beginner

jaen19:11:23

Neither, really.

roelof20:11:05

oke, I will continue reading brave and I hope when I ends that book , One of the books can be the next one

seancorfield20:11:45

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.

seancorfield20:11:16

They're both very practical books.

seancorfield20:11:54

My other strong recommendation is Emerick's Clojure Programming on O'Reilly.

roelof20:11:46

Thanks all.

roelof20:11:02

@seancorfield: I had it all because of a question earlier about a state question for a toy project which I have in mind

roelof20:11:46

I call it a day, Going watching tv and then I hope I sleep well. Tomorrow and Saterday very busy days