calva icon indicating copy to clipboard operation
calva copied to clipboard

How to properly discover tests in VSCode?

Open johnnywell opened this issue 3 years ago • 5 comments

I've noticed the tests appear in the VSCode testing menu after I manually run them for the first time. Is there a way to make it discover all the tests beforehand?

johnnywell avatar Jul 25 '22 15:07 johnnywell

Is this the issue you're having, and does the proposed fix there solve it? https://calva.io/test-runner/#tests-are-not-found

If not, @marcomorain might be able to provide more info since he implemented that feature.

bpringe avatar Jul 26 '22 00:07 bpringe

I'm running a Leiningen project with :test-paths ["test"] in the defproject.

johnnywell avatar Nov 11 '22 14:11 johnnywell

To clarify: The tests are shown in the VSCode interface. But, I get the message ; No tests found. 😱, ns: 0, vars: 0 in the REPL if I run them. The same happens if I choose to run all tests, tests from namespace or current test.

johnnywell avatar Nov 11 '22 15:11 johnnywell

I can't reproduce. I tried with a Lein project with my tests path in :test-paths. My steps:

  1. Jacked in
  2. Loaded the file with the tests in it
  3. Ran the command to run all tests

Are you starting your repl with jack-in? If you aren't, then the issue may be that your repl doesn't have the required dependency (cider-nrepl) to run the tests. You can see what Calva adds to the repl in the jack-in command when you jack-in, and you can also run the command for copying the jack-in command to the clipboard and then paste it to start your repl, if you want to start it manually and connect.

bpringe avatar Nov 17 '22 04:11 bpringe

Well, if your repl were missing cider-nrepl, you should see this message when you try to run tests (unless maybe you're on an old version of Calva):

; The server does not recognize or cannot perform the 'test-var-query' operation

In any case, what version of Calva are you using?

If cider-nrepl missing isn't the issue, then if you can provide a simple repo that I can use to reproduce the issue, that would be helpful.

bpringe avatar Nov 17 '22 04:11 bpringe