tpope / vim-fireplace

fireplace.vim: Clojure REPL support
https://www.vim.org/scripts/script.php?script_id=4978
1.75k stars 139 forks source link

`:RunTests` doesn't run any tests, reports success #409

Open rtfb opened 1 year ago

rtfb commented 1 year ago

Hi and thanks for making vim-fireplace!

I stumbled upon a curious problem - when I run :RunTests, fireplace doesn't actually run anything, it fast forwards to reporting success:

Success: (clojure.test/run-tests 'isa2-assembler.disasm-test)

However, all other things seem to be working correctly, for example if I call run-tests directly in the Quasi-REPL (i.e. the cqc window), that does run the tests and reports test failures as I expect:

(clojure.test/run-tests 'isa2-assembler.disasm-test)                             

Testing isa2-assembler.disasm-test
hello from disasm/run

FAIL in (test-disassembler-returns-null) (disasm_test.clj:11)
The disassembler entry point returns null
expected: (= nil (run [154]))
  actual: (not (= nil 5))

Ran 1 tests containing 1 assertions.
1 failures, 0 errors.
{:test 1, :pass 0, :fail 1, :error 0, :type :summary}
Press ENTER or type command to continue

I have found another person reporting a similar problem here on StackOverflow. Similarly to that SO question, I'm running nrepl in a Docker as well. However, his advice to fiddle with the order of plugins doesn't help me.

I've added a bit of debug logging to s:handle_test_response to inspect what data it gets:

  for [mkey, mval] in items(a:message)
    echo 'message[' . mkey . '] = ' . mval
  endfor

and it seems like it's receiving data in a format it does not expect. Here's what I get in my message trace:

 RunTests
Started: (clojure.test/run-tests 'isa2-assembler.disasm-test)
message[id] = 724db3ca-19e9-4f5b-b3aa-d61bd69fbf7f
message[out] =
Testing isa2-assembler.disasm-test

message[session] = b554a2fc-d0fe-4863-b8e0-5c982967c7a6
message[id] = 724db3ca-19e9-4f5b-b3aa-d61bd69fbf7f
message[out] = hello from disasm/run

message[session] = b554a2fc-d0fe-4863-b8e0-5c982967c7a6
message[id] = 724db3ca-19e9-4f5b-b3aa-d61bd69fbf7f
message[out] = isa2_assembler/disasm_test.clj   9       fail    test-disassembler-returns-null

message[session] = b554a2fc-d0fe-4863-b8e0-5c982967c7a6
message[id] = 724db3ca-19e9-4f5b-b3aa-d61bd69fbf7f
message[out] = The disassembler entry point returns null

message[session] = b554a2fc-d0fe-4863-b8e0-5c982967c7a6
message[id] = 724db3ca-19e9-4f5b-b3aa-d61bd69fbf7f
message[out] = expected: (= nil (run [154]))

message[session] = b554a2fc-d0fe-4863-b8e0-5c982967c7a6
message[id] = 724db3ca-19e9-4f5b-b3aa-d61bd69fbf7f
message[out] =   actual: (not (= nil 5))

message[session] = b554a2fc-d0fe-4863-b8e0-5c982967c7a6
message[id] = 724db3ca-19e9-4f5b-b3aa-d61bd69fbf7f
message[out] =
Ran 1 tests containing 1 assertions.

message[session] = b554a2fc-d0fe-4863-b8e0-5c982967c7a6
message[id] = 724db3ca-19e9-4f5b-b3aa-d61bd69fbf7f
message[out] = 1 failures, 0 errors.

message[session] = b554a2fc-d0fe-4863-b8e0-5c982967c7a6
message[id] = 724db3ca-19e9-4f5b-b3aa-d61bd69fbf7f
message[session] = b554a2fc-d0fe-4863-b8e0-5c982967c7a6
message[ns] = isa2-assembler.disasm-test
message[value] = {:test 1, :pass 0, :fail 1, :error 0, :type :summary}

Looking at s:handle_test_response code, it doesn't seem to expect any of these keys, it's looking up something else.

I'm not sure this is a bug in vim-fireplace, could be a problem with my setup, but it manifests in a way that may benefit from some sort of defensive fix. Does this resemble any known problem? How can I debug this further?

Versions of the software I run in the container:

$ clj --version
Clojure CLI version 1.11.1.1200
$ lein version
Leiningen 2.10.0 on Java 11.0.17 OpenJDK 64-Bit Server VM
$ cat .lein/profiles.clj 
{:user {:plugins [[cider/cider-nrepl "0.29.0"]]}}

Vim is running on the host, though. Is it possible that vim-fireplace picks up something incompatible from the host machine?