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

Expressions for first arg of clojure.test/testing generates missing test assertion warnings #2083

Closed
khardenstine opened this issue May 18, 2023 · 2 comments

Comments

@khardenstine
Copy link

version

2023.05.18

problem

Using an expression as the first argument of clojure.test/testing generates "missing test assertion" warnings

repro

(ns repro
  (:require
    [clojure.test :refer [deftest testing is]]))

(deftest foo
  (testing (str "str " "some " "strings")
    (is (= 1 2))))
clj-kondo --lint repro.clj
repro.clj:6:12: warning: missing test assertion
linting took 9ms, errors: 0, warnings: 1

expected behavior

no warning

@borkdude
Copy link
Member

Thanks for this repro. You can work around this with:

(ns repro
  (:require
   [clojure.test :refer [deftest testing is]]))

(deftest foo
  (testing #_:clj-kondo/ignore (str "str " "some " "strings")
    (is (= 1 2))))

for the time being.

@borkdude
Copy link
Member

borkdude commented May 18, 2023

Explanation how this was introduced:

(deftest foo (not (= 1 2)))

did not trigger a warning, so all "pure" functions like not that are not wrapped in an is now report a :missing-test-assertion (whereas (testing "foo" (true? (= 1 2))) did trigger such a warning, but the first argument to testing should not be considered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants