Back

run-test (clj)

(source)

macro

(run-test test-symbol)
Runs a single test. Because the intent is to run a single test, there is no check for the namespace test-ns-hook.

Examples

clojure
(ns clojure.test-clojure.run-single-test
  (:require [clojure.test :refer [is deftest run-test run-tests]]
            [clojure.test-helper :refer [with-err-string-writer]]
            [clojure.test-clojure.test-fixtures :as tf]))

(deftest reports-missing-var
  (should-print-to-err #"^Unable to resolve .*/function-missing to a test function.*"
    (let [result (eval `(run-test function-missing))]
      (is (nil? result)))))

(deftest reports-non-test-var
  (should-print-to-err #"^.*/not-a-test is not a test.*"
    (let [result (eval `(run-test not-a-test))]
      (is (nil? result)))))

(deftest can-run-test-with-fixtures
  (is (= {:test 1, :pass 2, :fail 0, :error 0, :type :summary}
        (run-test tf/can-use-once-fixtures))))
cognitect-labs/vase
(require '[clojure.test :refer [run-tests]])

(deftask test
  "Run project tests"
  []
  (with-test) ;; test source paths and test/dev deps added
  (require '[clojure.tools.namespace.find :refer [find-namespaces-in-dir]])
  (let [find-namespaces-in-dir (resolve 'clojure.tools.namespace.find/find-namespaces-in-dir)
        test-nses              (->> (get-env :test-paths)
                                    (mapcat #(find-namespaces-in-dir (clojure.java.io/file %)))
                                    distinct)]
    (doseq [tns test-nses] (require tns))
    (apply clojure.test/run-tests test-nses)))
borkdude/deflet
(ns playwright.example
  (:require ["playwright$default" :refer [chromium]]
            [clojure.test :as t :refer [deftest is async]]
            [borkdude.deflet :refer [defletp defp]]
            [promesa.core :as p]))

  (t/run-tests *ns*)
walmartlabs/test-reporting
(ns user
  (:require
    [clojure.test :refer [is deftest run-tests]]
    [com.walmartlabs.test-reporting :refer [reporting]]))

(comment
  (run-tests)
  )
candera/khordr
(require '[clojure.test :refer :all]
         '[khordr.handler :as h]
         '[khordr.handler.modifier-alias :refer :all]
         '[khordr.effect :as e]
         '[khordr.test.handler :refer :all])

(test/run-tests 'khordr.test.handler.modifier-alias)
samedhi/ctci
(require '[clojure.test :as t])

(t/run-tests *ns*)