I am writing a small Clojure project using leiningen with the following directory structure:
project
+ src
+ org/example/project/core.clj
+ test
+ org/example/project/core.clj
When I run lein test
, it reports that it ran 0 tests with 0 failures, but I purposely put a test designed to fail in the test/.../core.clj file.
I added the line :test-path test
to my project.clj
file and when I re-ran, got the error:
Exception in thread "main" java.lang.IllegalArgumentException: No implementation of method: :as-file of protocol: #'clojure.java.io/Coercions found for class: clojure.lang.Symbol (NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:5440)
at clojure.lang.Compiler.eval(Compiler.java:5391)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$script_opt.invoke(main.clj:270)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:458)
at clojure.lang.Var.invoke(Var.java:377)
at clojure.lang.AFn.applyToHelper(AFn.java:174)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.main.main(main.java:37)
Caused by: java.lang.IllegalArgumentException: No implementation of method: :as-file of protocol: #'clojure.java.io/Coercions found for class: clojure.lang.Symbol
at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:471)
at clojure.java.io$fn__7328$G__7323__7333.invoke(io.clj:34)
at clojure.java.io$file.invoke(io.clj:401)
at leiningen.util.ns$namespaces_in_dir.invoke(ns.clj:38)
at leiningen.test$test.doInvoke(test.clj:45)
at clojure.lang.RestFn.invoke(RestFn.java:411)
at clojure.lang.Var.invoke(Var.java:365)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$apply_task.invoke(core.clj:156)
at leiningen.core$_main.doInvoke(core.clj:212)
at clojure.lang.RestFn.applyTo(RestFn.java:138)
at clojure.core$apply.invoke(core.clj:540)
at leiningen.core$_main.invoke(core.clj:217)
at user$eval167.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5424)
... 11 more
I am running Clojure 1.2 and the latest lein (1.3.1).
Looks like a problem with either clojure.core or the lein code.
Had the same issue. After a while I noticed that leins default path to tests are:
test/{project-name}/test/{file-under-test}.clj
^^^^
Note an extra test
directory in the path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With