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

Test runner output only partially commented #787

Closed
stefan-toubia opened this issue Sep 19, 2020 · 7 comments
Closed

Test runner output only partially commented #787

stefan-toubia opened this issue Sep 19, 2020 · 7 comments
Labels
bug Something isn't working test-runner

Comments

@stefan-toubia
Copy link
Contributor

stefan-toubia commented Sep 19, 2020

When a test run fails and shows the expected/actual diffs, only the first line is commented

 ; expected: #{{:id 1002197,
   :display-name "Campaign 1002198",
   :state "enabled"}}
; actual:  (#{{:id 1002197,
    :display-name "Campaign 1002198",
    :state "enabled"}})

It seems preferable that the diff output would not be commented, maybe there should always be a new line after expected and actual so that the text is commented but the output is not?

 ; expected:
#{{:id 1002197,
   :display-name "Campaign 1002198",
   :state "enabled"}}
; actual:
(#{{:id 1002197,
    :display-name "Campaign 1002198",
    :state "enabled"}})

While we're at it, I was wondering if there's a reason the actual output is always in a list () whereas expected is not formatted this way?

Last thing, I'm liking the new output method with the file, much more reliable doing paredit in an actual file, I'm imagining it's less complex than having a whole repl window module too! Do you know if it's possible to customize the color of the comments in this file alone? Green seems pretty appropriate in normal cases, but is a bit hard to read large blocks of for the test runner output.

@PEZ
Copy link
Collaborator

PEZ commented Sep 19, 2020

While I think that this last thing should go in an issue of its own, I can't resist commenting on it. 😄 Yes, it is possible. But it would need to be done via the highlight module, I can talk you through it some on slack or something, if you want to take it on.

@bpringe bpringe added enhancement test-runner bug Something isn't working and removed enhancement labels Sep 19, 2020
@bpringe
Copy link
Member

bpringe commented Sep 19, 2020

So, Calva is calling test-var-query from cider-nrepl to run tests and get results. Those results are coming back with actual being a list, and I'm not sure why. @bbatsov might have more insight here - I also pinged him in slack.

Another thing that confuses me is when I run a test to simulate your output, it all comes back on one line in the results (no newline characters). With this test:

(with-test
  (defn foo []
    #{{:id 1010101
       :display-name "Campaign 1010101"
       :state "enabled"}})
  (is (= #{{:id 1010102
            :display-name "Campaign 1010101"
            :state "enabled"}} 
         (foo))))

I get these results (as seen in the debug pane):
image

And hence it prints in the output window like:

; Running test: foo…
; FAIL in core/foo (core.clj:24):
;   expected: #{{:id 1010102, :display-name "Campaign 1010101", :state "enabled"}}
;   actual: (#{{:id 1010101, :display-name "Campaign 1010101", :state "enabled"}})
; 1 tests finished, problems found. 😭 errors: 0, failures: 1, ns: 1, vars: 1

@bpringe
Copy link
Member

bpringe commented Sep 19, 2020

I guess the newline thing could be my pprint settings... I'll look into that.

Edit: Yes 😆, it just wasn't wrapping because it wasn't large enough. Will carry on...

@bpringe bpringe mentioned this issue Sep 19, 2020
22 tasks
@bpringe
Copy link
Member

bpringe commented Sep 19, 2020

@stefan-toubia
Copy link
Contributor Author

@bpringe Another great fix, thanks!

@PEZ
Copy link
Collaborator

PEZ commented Sep 20, 2020

I'm lazy, so haven't checked before suggesting: Make an issue for the extra parens things. They have bit me many times, but lately I have finally learnt to ignore them, which is totally the wrong solution.

@bpringe
Copy link
Member

bpringe commented Sep 20, 2020

I've made a new issue, #794. Knowing what I know, I'm assuming it's an upstream issue and tagged Bozhidar Batsov in that thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working test-runner
Projects
None yet
Development

No branches or pull requests

3 participants