venantius / ultra

A Leiningen plugin for a superior development environment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clojure 1.8 stacktraces problem

Trylobot opened this issue · comments

> lein test - output not enhanced
> lein repl \ (run-tests) - output enhanced

How can I get your stuff working with lein test? It's more convenient for me than (run-tests)

What version of Ultra are you using? It should be working with lein test.

Hmm. So, Ultra is active, but it's not active for stacktraces. I'll look into this.

I think this is because stacktraces within the tests are using a stacktrace printing method that I haven't targeted. Trying to run the tests at the REPL produces the same result. I'll look into this further.

Thanks! Love your plugin, by the way. Every Clojurist at my company is using it 👍

That's awesome! What company?

Yodle (just acquired by web.com)

Hello! I had a look at this and I think adding the following to the ultra.test namespace would solve the issue:

(defmethod report :error [m]
  (with-test-out
   (inc-report-counter :error)
   (println "\nERROR in" (testing-vars-str m))
   (when (seq *testing-contexts*) (println (testing-contexts-str)))
   (when-let [message (:message m)] (println message))
   (println "expected:" (pr-str (:expected m)))
   (print "  actual: ")
   (let [actual (:actual m)]
     (if (instance? Throwable actual)
       (pretty-repl/pretty-print-stack-trace actual)
       (prn actual)))))

This is adapted from the original report code here:
https://github.com/clojure/clojure/blob/clojure-1.8.0/src/clj/clojure/test.clj#L383-L394

With the only difference being (pretty-repl/pretty-print-stack-trace actual) instead of (stack/print-cause-trace actual *stack-trace-depth*)

@Jell wanna make a PR? 😄

@venantius I made one here: #73

Any update on this?

Just left some comments on the PR.

I've updated the PR

This has been resolved by #73 -- I'll push out a release later today.