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

Run All Tests command doesn't run tests in .cljc file with reader conditional in ns #1328

Closed
andriikovalov opened this issue Oct 10, 2021 · 6 comments

Comments

@andriikovalov
Copy link

Steps to reproduce:

  1. Create a new lein app lein new app test-app
  2. Rename core_test.clj in to core_test.cljc
  3. In core_test.cljc change [clojure.test :refer :all] to #?(:clj [clojure.test :refer :all])
  4. Open project directory in VS Code, jack-in
  5. Invoke Run All Tests command, expected: failing test in REPL, actual: "No tests found"
@bpringe
Copy link
Member

bpringe commented Oct 11, 2021

Do any of the other test commands work in this situation? I wonder if cider-nrepl (which is used for running tests), only checks .clj files.

@andriikovalov
Copy link
Author

Yes, I tried "Run tests for current namespace" and "Run current test", and they both work (I see output with test results in REPL).

Here are some other things I noticed with "Run all tests":

  • .cljc file without reader conditionals: works
  • .cljc with a reader conditional inside a test: works
  • .cljc with a reader conditional in ns :require (as in the description): no tests found

@bpringe
Copy link
Member

bpringe commented Oct 13, 2021

Interesting, thanks for the added details.

@bpringe bpringe added this to To do in Brandon's Board via automation Oct 13, 2021
@bpringe
Copy link
Member

bpringe commented Dec 4, 2021

So, Calva is running the deprecated test-all op of cider-nrepl to run all tests.

We can try using the not deprecated test-var-query op to run all tests and see if that fixes this issue. I noticed that running the tests for the namespace works, which uses test-var-query.

@marcomorain Since you've been working on test-related stuff, would you like to tackle this when you have time? If not, I can do it eventually.

@marcomorain
Copy link
Contributor

marcomorain commented Dec 7, 2021

I'm taking a quick look now.

marcomorain added a commit to marcomorain/calva that referenced this issue Dec 7, 2021
Remove use of deprecated Cider commands, in favour of the supported
test-var-query. This fixes an issue with cljc conditionals impacting the
ability to run tests.

Fixes: BetterThanTomorrow#1328
marcomorain added a commit to marcomorain/calva that referenced this issue Dec 7, 2021
Remove use of deprecated Cider commands, in favour of the supported
test-var-query. This fixes an issue with cljc conditionals impacting the
ability to run tests.

Fixes: BetterThanTomorrow#1328
@marcomorain
Copy link
Contributor

👍 PR open which fixes this.

Brandon's Board automation moved this from To do to Done Dec 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants