Fork me on GitHub
#kaocha
<
2019-08-08
>
plexus06:08:17

Not as such, but should be quite doable with a plugin

πŸ‘ 4
avi07:08:59

Cool, thanks!

magnars07:08:48

The docs for kaocha.repl/run says that output is sent to stdout, but I'm not able to capture it.

(require 'kaocha.repl)
(with-out-str
  (kaocha.repl/run)) ;; => ""
Any ideas? πŸ™‚

magnars07:08:07

(the test report is still displayed in my repl)

plexus07:08:45

not off the top of my head @magnars, I'm guessing *out* is being rebound more than once, maybe in the output capturing plugin. Does it work if you disable output capturing?

magnars07:08:26

I'll give that a shot!

magnars08:08:07

Running:

(with-out-str
    (kaocha.repl/run {:capture-output? false}))

magnars08:08:11

I still get ""

magnars08:08:18

but now my repl looks like this:

magnars08:08:12

To give some context: I'm trying to make a kaocha plugin for Emacs, showing output in a separate buffer πŸ™‚

magnars10:08:21

If you have any ideas at all, @plexus I'd be happy to try them out.

plexus10:08:01

(defmacro with-test-out-str
    [& body]
    `(let [s# (new java.io.StringWriter)]
       (binding [clojure.test/*test-out* s#]
         ~@body
         (str s#))))

  (with-test-out-str 
    (kaocha.repl/run))
@magnars this seems to do the trick, clojure test has its own *test-out* var for this purpose

magnars10:08:26

Aha! Brilliant β€οΈπŸ˜„ I'll check it out at once.

magnars10:08:07

Excellent, that did the trick. Now I have some fun emacs lisp coding to do in preparation for the next live stream. πŸ™‚

magnars10:08:17

Thanks for the help!

plexus11:08:04

Looking forward! This has been requested more than one :)

vikeri11:08:51

Just want to say that I migrated all our backend tests to kaocha and it’s very nice! Great work @plexus and others who contributed!

plexus11:08:41

That's awesome @vikeri! Really nice to hear!

πŸ‘ 4