venantius / ultra

A Leiningen plugin for a superior development environment
Eclipse Public License 1.0
1.24k stars 37 forks source link

Clojure 1.8 stacktraces problem #57

Closed Trylobot closed 7 years ago

Trylobot commented 8 years ago

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

venantius commented 8 years ago

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

Trylobot commented 8 years ago

0.4.1

clone https://github.com/Trylobot/hive-clj lein test

venantius commented 8 years ago

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

venantius commented 8 years ago

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.

Trylobot commented 8 years ago

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

venantius commented 8 years ago

That's awesome! What company?

Trylobot commented 8 years ago

Yodle (just acquired by web.com)

Jell commented 7 years ago

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*)

venantius commented 7 years ago

@Jell wanna make a PR? 😄

Jell commented 7 years ago

@venantius I made one here: https://github.com/venantius/ultra/pull/73

tacticiankerala commented 7 years ago

Any update on this?

venantius commented 7 years ago

Just left some comments on the PR.

Jell commented 7 years ago

I've updated the PR

venantius commented 7 years ago

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