我创建了一个新的Clojurescript / Om项目。目录结构如下所示:
├── 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
我的package.json
非常小,看起来像这样:
(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"])
然而,我无法让Leiningen认识到测试路径。当我运行lein test
时,我看到了:
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.
我将测试从test/clj/example-project/...
移至test/example-project/...
,将实施从src/clj/example-project/
移至src/example-project
,但我仍然看到相同的错误。
如何让Leiningen认识我的测试?
答案 0 :(得分:2)
也许:test-paths
需要进一步扩展,以便lein找到源代码。
你可以尝试:
:test-paths ["test/clj"]
我看到你使用基本相同的思维来移动源代码。但这更容易。在对project.clj
进行任何更改后,您需要lein clean
然后lein deps
。我的方式更多地是关于deps
而更多关于clean
,但两者都是权宜之计。你还需要检查clean
是否真的摆脱了输出。如果不是,您可以通过删除文件来手动清理。