Dear Calva friends. calva https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.557 • Add “Restart the Project REPL (a.k.a. Re-jack-in)” option to the connected REPL menu This is actually an alias to the regular jack-in command, which already disconnects and re-connects as necessary. But this was not obvious enough to users.
Here's a weird one: when I run a test that uses https://github.com/nubank/matcher-combinators using an external test runner, I get an output that looks like this:
FAIL in (string-with-quotes-test) (test_test.clj:120)
expected: (match? "foo bar" [])
actual: (mismatch (expected "foo bar") (actual []))
But when I run it in Calva's test runner with the REPL window output destination, I get this:
; FAIL in (string-with-quotes-test) (test_test.clj:120)
; expected:
(match? "foo bar" [])
; actual:
(mismatch (expected foo bar) (actual []))
Notice that the quotes around "foo bar" are gone. This isn't great b/c it makes it hard to tell what's actually in the failing data. For example:
(is (match? "foo bar"
["foo" "bar"]))
;=>
(mismatch (expected foo bar) (actual [foo bar]))
(is (match? "foo bar"
["foo bar"])
;=>
(mismatch (expected foo bar) (actual [foo bar]))
Both of these examples result in the same output, despite them having different inputs.
Any ideas as to why Calva's test runner would be removing the quotes?I'm curious if you'd see the same thing if you set all the Calva output destinations to terminal?
It's the same in the terminal output destination
I vaguely recognize this… But can’t quite recall.
Any idea where I would go looking for the cause of the issue?
I would catch it in the debugger and examine the stack frames.
Seems 100% to me as something in Calva. There is not much indirection between the nrepl response and what Calva prints, so should be quick to spot. But that could be famous last words all over.
Any hints for where to stick the breakpoint for a newbie to the code base?
I’m afk, but there’s an output module, so if you catch it there you can backtrack all the way through the whole chain.
As best I can tell, it's coming from the repl server that way. I'm seeing no quotes all the way up to a call to session.test https://github.com/maxrothman/calva/blob/46a909b86d4a0244af5f9b72aac4697d85e82cf9/src/testRunner.ts#L383 which is where it looks like the request to run the test is sent to the server. Here's the whole string it has:
; FAIL in minimal.hello/foo (hello.clj:6):
; expected:
(match? "foo" ["foo"])
; actual:
(mismatch (expected \x1b[33mfoo\x1b[0m) (actual \x1b[31m[foo]\x1b[0m))
The escape sequences are color codes, but there's no quotes in sight.
Could this maybe be coming from cider instead?That answer seems plausible, cider https://github.com/clojure-emacs/cider/issues?q=is%3Aissue%20matcher-combinators and has special handling to deal with escape codes. I'll post over there
Wow. My first suggestion, which I suppressed, was to check the Calva nrepl log, 😀
It wouldn't have helped, it truncates the map
We should fix that.
It looked somewhat intentional. More accurately, it didn't expand maps deeply nested in the data
It looked like this:
{
'elapsed-time': { humanized: 'Completed in 6 ms', ms: 6 },
'gen-input': [],
id: '15',
'ns-elapsed-time': { 'minimal.hello': { humanized: 'Completed in 6 ms', ms: 6 } },
results: { 'minimal.hello': { foo: [Array] } },
session: '90e21166-dd42-493c-9733-c9f1f9a06fab',
summary: { error: 0, fail: 1, ns: 1, pass: 0, test: 1, var: 1 },
'testing-ns': 'minimal.hello',
'var-elapsed-time': { 'minimal.hello': { foo: [Object] } }
}
You can see a few spots (`[Array]`, [Object] where it wasn't fully expandedYes, it is somewhat intentional. Responses can be huge. But some way to either specify the depth or to drill down, could be devised.
I almost wonder if you want to log them to the debug console where they can be expanded as needed
Yeah, sounds super pragmatic and helpful.
We could consider switching to logging to the debug console instead of the output channel…
Dear Calva friends. calva https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.558 • https://github.com/BetterThanTomorrow/calva/issues/3091 A follow up on the mere cosmetic update earlier today. Now it is truly re-jack-in.
Missed the re-jack-in since the multi nrepl update. Thanks for adding it back and this one too.
You should have told me you missed it! 😃
But this was good in the end because the contributor who added it also wanted it to be a more proper jack-in, something I hadn’t really thought about, when I instead deemed it a waste of menu space to have the same command twice with different names.