BetterThanTomorrow / calva

Clojure & ClojureScript Interactive Programming for VS Code
https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.calva
Other
1.66k stars 217 forks source link

Have test runner show diff between "actual" and "expected" #1007

Open svdo opened 3 years ago

svdo commented 3 years ago

It would be awesome if the test runner would (in the Calva output) not just show what was the expected and actual output, but also what's the difference between the two. We've been using the "ultra" leiningen plugin in the terminal for this, which shows it super-super-nicely (see https://github.com/venantius/ultra/wiki/Tests). I don't know if they use some library that can be reused by Calva...?

bpringe commented 3 years ago

Looks like they use clojure.data.diff, at least for some or most of the diffs: https://github.com/venantius/ultra/blob/c254cb96d6f7b05773c32e2925d8f87761780936/src/ultra/test.clj#L13

svdo commented 3 years ago

There is also this btw: https://github.com/lambdaisland/deep-diff2. I like the rendering of the diffs from Ultra better than those from Kaocha, but maybe the diff engine is easier to integrate?

mrkam2 commented 1 year ago

Here is cider-nrepl implementation of test output diffing: https://github.com/clojure-emacs/cider-nrepl/blob/a53ab41c7ae56fda9f4a7b5916c5bd1f8fa60d95/src/cider/nrepl/middleware/test/extensions.clj#L22-L23.

bpringe commented 1 year ago

So is that the wrap-test middleware supplied by cider-nrepl? If if is, then I think if that middleware is present in the running repl then Calva should be getting that diff info already. We may just need to display it in the output window.