Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
svdo opened this issue Feb 2, 2021 · 4 comments
Open

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

svdo opened this issue Feb 2, 2021 · 4 comments
Labels

Comments

@svdo
Copy link
Contributor

svdo commented Feb 2, 2021

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
Copy link
Member

bpringe commented Feb 2, 2021

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
Copy link
Contributor Author

svdo commented Feb 3, 2021

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
Copy link
Contributor

mrkam2 commented May 15, 2023

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
Copy link
Member

bpringe commented May 16, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants