2016-04-12 42 views
1

我創建了一個新的Clojurescript/Om項目。目錄結構是這樣的:更改Clojure/Leiningen項目中的測試目錄

├── 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認出我的測試?

回答

1

也許:test-paths需要進一步到達,以便可以通過lein找到源代碼。

你可以嘗試:

:test-paths ["test/clj"] 

我看你搬來搬去使用基本相同的思想的源代碼。但這很容易。同樣在project.clj發生任何變化之後,您需要lein clean,然後lein deps。我的方式更多地是關於deps以及更多關於clean的問題,但兩者都適合。此外,您還需要檢查clean是否真正擺脫了輸出。如果不是,您可以隨時通過刪除文件進行手動清理。