Reputation: 1839
I created a new Clojurescript/Om project. The directory structure looks like this:
├── project.clj
├── resources
│ └── public
│ ├── index.html
│ └── src
│ └── om_tutorial
│ └── core.cljs
├── script
│ └── figwheel.clj
├── src
│ ├── clj
│ │ ├── test
│ │ └── example-project
│ │ └── core.clj
│ └── cljs
│ └── example-project
│ └── core.cljs
├── target
│ ├── classes
│ │ └── META-INF
│ │ └── maven
│ │ └── typing
│ │ └── typing
│ │ └── pom.properties
│ └── stale
│ └── leiningen.core.classpath.extract-native-dependencies
└── test
└── clj
└── example-project
└── test_core.clj
My package.json
is very minimal, and it looks like this:
(defproject typing "0.1.0-SNAPSHOT"
:description "example-project"
:dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.7.170"]
[org.omcljs/om "1.0.0-alpha22"]
[figwheel-sidecar "0.5.0-SNAPSHOT" :scope "test"]
[http-kit "2.2.0-SNAPSHOT"]
[compojure "1.5.0"]
[ring "1.4.0"]
[cheshire "5.5.0"]]
:test-paths ["test"])
However, I can't get Leiningen to recognize the test path. When I run lein test
, I see:
Exception in thread "main" java.io.FileNotFoundException: Could not locate test/typing/test_core__init.class or test/example-project/test_core.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name., compiling:(/private/var/folders/dk/jvt798yj6ds6wnkwk_24wrcm0000gp/T/form-init5157365051258208935.clj:1:125)
...
Caused by: java.io.FileNotFoundException: Could not locate test/example-project/test_core__init.class or test/example-project/test_core.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
...
Tests failed.
I moved the tests from test/clj/example-project/...
to test/example-project/...
, and the implementation from src/clj/example-project/
to src/example-project
but I still see the same error.
How do I get Leiningen to recognize my tests?
Upvotes: 4
Views: 1141
Reputation: 6509
Perhaps the :test-paths
need to reach in further so that source code can be found by lein.
You could try:
:test-paths ["test/clj"]
I see you moved source code around using basically the same thinking. But this is easier. Also after any changes to project.clj
you need to lein clean
then lein deps
. My way is more about the deps
and yours more about the clean
, but both regardless is expedient. Also you need to check that clean
is actually getting rid of output. If it is not you can always manually clean by deleting files.
Upvotes: 6