Reputation: 474
I have a leiningen plugin consisting of the following function:
(defn vscode-test
"Simple test run"
[project & args]
(leiningen.core.eval/eval-in-project project `(clojure.test/run-all-tests)))
When I run this with lein vscode-test
inside a Clojure project with a project.clj
file clojure.test/run-all-tests
runs, but it doesn't find any of the tests in the project. Note that lein test
does run all the tests.
My project.clj
is
(defproject repl_test "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:source-paths ["src" "test" "dev"]
:plugins [[vscode-test "0.1.0-SNAPSHOT"]]
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/core.async "0.3.442"]
[org.clojure/tools.namespace "0.2.11"]])
Why doesn't the plugin see the tests?
Upvotes: 1
Views: 618
Reputation: 17773
clojure.test/run-all-tests
runs all currently defined tests. lein test
first loads the test definitions in the test
directory and then calls the clojure.test
code.
In other words; you're not running any tests because the code you've provided doesn't load / require the namespaces containing your tests.
Upvotes: 1