diff --git a/corpus/deftest.cljc b/corpus/deftest.cljc new file mode 100644 index 0000000000..837650277c --- /dev/null +++ b/corpus/deftest.cljc @@ -0,0 +1,16 @@ +(ns deftest + (:require [clojure.test :refer [deftest is are]]) + (:import clojure.lang.ExceptionInfo)) + +(deftest are-test + (are [?a ?b] + (is (= ?a (dec ?b))) + 1 2 + 10 11 + 14 15)) + +(deftest thown-with-msg-test + (is (thrown-with-msg? + ExceptionInfo #"uh oh" + (throw (ex-info "uh oh" {})))) + (is (thrown? ExceptionInfo (throw (ex-info "uh oh" {}))))) diff --git a/src/clj_kondo/impl/config.clj b/src/clj_kondo/impl/config.clj index 7ae1fc4826..67a4d35a0c 100644 --- a/src/clj_kondo/impl/config.clj +++ b/src/clj_kondo/impl/config.clj @@ -41,9 +41,9 @@ #_(riemann.streams/where [service event]) ;; ignore all unresolved symbols in one-of: #_(clj-kondo.impl.utils/one-of) - (clojure.test/are) - (clojure.test/is [thrown-with-msg?]) - ]} + (clojure.test/are) (cljs.test/are) + (clojure.test/is [thrown? thrown-with-msg?]) + (cljs.test/is [thrown? thrown-with-msg?])]} :misplaced-docstring {:level :warning} :not-empty? {:level :warning}} :lint-as {cats.core/->= clojure.core/-> diff --git a/test/clj_kondo/main_test.clj b/test/clj_kondo/main_test.clj index 48704adb4a..26829989c6 100644 --- a/test/clj_kondo/main_test.clj +++ b/test/clj_kondo/main_test.clj @@ -1767,7 +1767,9 @@ (is (empty? (lint! "(cond-> 1 true (as-> x (inc x)))"))) (is (empty? (lint! "(reify clojure.lang.IDeref (deref [_] nil))"))) (is (empty? (lint! "(ns foo) (defn foo [] (ns bar (:require [clojure.string :as s])))"))) - (is (empty? (lint! "(defn foo [x y z] ^{:a x :b y :c z} [1 2 3])")))) + (is (empty? (lint! "(defn foo [x y z] ^{:a x :b y :c z} [1 2 3])"))) + (is (empty? (lint! (io/file "corpus" "deftest.cljc") + '{:linters {:unresolved-symbol {:level :error}}})))) (deftest file-error-test (assert-submaps '({:file "not-existing.clj",