bensu / doo

doo is a library and lein plugin to run cljs.test on different js environments.
Eclipse Public License 1.0
324 stars 63 forks source link

Adding test middleware #85

Open lvh opened 8 years ago

lvh commented 8 years ago

How do I add test middleware to doo? Right now, the test errors can be somewhat limited in their utility, notably:

  1. I don't see full tracebacks
  2. I can't pretty-print errors, e.g.:
FAIL in (parse-row-tests) (:)
non-whitespace rows
expected: (= (c/parse-row status-row) (assoc parsed-status-row :unparsed-row status-row))
  actual: (not (= {:row-type :header, :card-type :status, :timestamp #object[Object 20150728T063200], :author {:name "Support McAgent", :link "somewhere"}, :from "New", :to "In Progress", :source :core, :unparsed-row [:tr {:style "stylish"} [:td {:style "classy"} "07/28/2015"] [:td {:style "swanky"} "6:32 am"] [:td {:style "swaggerful"} [:a {:onclick "doSomething()", :target "_new", :href "somewhere"} "Support McAgent"]] [:td {} "Status"] [:td {:style "awesome"} "New -> In Progress"] [:td {} " "]]} {:row-type :header, :card-type :status, :author {:name "Supporty McAgent", :link "somewhere"}, :source :core, :timestamp #object[Object 20150728T063200], :from "New", :to "In Progress", :unparsed-row [:tr {:style "stylish"} [:td {:style "classy"} "07/28/2015"] [:td {:style "swanky"} "6:32 am"] [:td {:style "swaggerful"} [:a {:onclick "doSomething()", :target "_new", :href "somewhere"} "Support McAgent"]] [:td {} "Status"] [:td {:style "awesome"} "New -> In Progress"] [:td {} " "]]}))

It would be great if there's a way to pretty-print that, or add the diff -- I believe humane-test-output does both?

bensu commented 8 years ago

Currently there is no way in doo to do this. Can you point me to some project that uses the middleware you want? Since I don't use this, I'm having in which step should the middleware be applied.

lvh commented 8 years ago

I just realized that the most important one, pjstadig/humane-test-output doesn't actually work on ClojureScript yet; I guess I'll try to make that work at some point.

@bensu: Have you noticed any issues trying to debug software where the test would just fail with a single line JavaScript error message? That's my main issue: sometimes (usually, when an exception is thrown), I get a fairly unhelpful error, e.g. telling me that... some vector only had one element, but not telling me where, or what it actually was, et cetera.

I guess this would be somewhat remediated if I could get CIDER to run my tests in my browser-attached figwheel REPL, but https://github.com/clojure-emacs/cider/issues/1268 womp womp womp :(

I haven't used karma recently, but this CircleCI testing post using karma but not doo seems to suggest that at least I'll get JS tracebacks?

dmh43 commented 8 years ago

I'm running into this issue as well. I'm struggling to get helpful test errors from doo. I'd like to take a stab at this, @bensu do you have any pointers on where to start to allow for test middleware?

@lvh have you made any progress on this?

lvh commented 8 years ago

@dmh43 I haven't attempted to address this.

lvh commented 8 years ago

FYI, humane-test-output now supports ClojureScript.