lein-cljsbuild icon indicating copy to clipboard operation
lein-cljsbuild copied to clipboard

Clean compile/build fails to resolve namespaces for cljs.test

Open hipitihop opened this issue 10 years ago • 3 comments

Issue: Clean compile gives the following error for valid namespaces :required in runner/suite. Same namespaces work fine when using cemerick/clojurescript.test Originally reported as CLJS-974 I was under the impression it was a cljs.test issue as that is the only environment I have encountered this problem. Reproduced here:

test/model/dimension_glossary_test.cljs

(ns test.model.dimension-glossary-test
  (:require
    [cljs.test       :refer-macros [is deftest]]))

(deftest arbitrary-test
   (is (= 1 2) "fixme")
   )

test/test_suite.cljs

 (ns test.test-suite
   (:require
     [cljs.test :refer-macros [run-tests]]
     [test.model.dimension-glossary-test])
   (:refer-clojure :exclude [set-print-fn!]))

 (enable-console-print!)

 (defn run-all-tests
   []
   (run-tests
     'test.model.dimension-glossary-test
     ))

Environment: Linux Ubuntu 14.04 Java 1.7.0_17 Java HotSpot(TM) 64-Bit Server VM leiningen 2.5.1 Intellij 13.1.6 with latest cursive 0.1.43 plugin

project.clj deps

:dependencies 
  [[org.clojure/clojure "1.6.0"] 
   [org.clojure/clojurescript "0.0-2665"] 
   [reagent "0.5.0-alpha"] 
   [alandipert/storage-atom "1.2.3"] 
   [com.andrewmcveigh/cljs-time "0.3.0"]] 
:plugins [[lein-cljsbuild "1.0.3"]]

Notes:

  • if compiled using "cljsbuild auto test" after giving failure, if you delete the test/test-suite.cljs the compile completes successfully, if then you revert the file it also recompiles successfully and tests run as expected.
  • happens every time on my machine but other devs on Windows platform don't seem to get this issue. The only difference I can see is I use leiningen checkouts feature to point at our other local repos and these are project dependencies. I have tested with removing the checkouts folder with no change in behaviour so I doubt it is related.

---------------------------- build output ----------------------------

Deleting files generated by lein-cljsbuild.
Compiling ClojureScript.
Compiling "compiled/test.js" from ["src" "test"]...
Compiling "compiled/test.js" failed.
clojure.lang.ExceptionInfo: failed compiling file:test/test_suite.cljs
core.clj:4403 clojure.core/ex-info
compiler.clj:1039 cljs.compiler/compile-file
compiler.clj:1069 cljs.compiler/compile-root
closure.clj:358 cljs.closure/compile-dir
closure.clj:398 cljs.closure/eval3160[fn]
closure.clj:306 cljs.closure/eval3096[fn]
closure.clj:412 cljs.closure/eval3147[fn]
closure.clj:306 cljs.closure/eval3096[fn]
compiler.clj:44 cljsbuild.compiler.SourcePaths/fn
core.clj:2557 clojure.core/map[fn]
LazySeq.java:40 clojure.lang.LazySeq.sval
LazySeq.java:49 clojure.lang.LazySeq.seq
RT.java:484 clojure.lang.RT.seq
core.clj:133 clojure.core/seq
core.clj:624 clojure.core/apply
core.clj:2586 clojure.core/mapcat
RestFn.java:423 clojure.lang.RestFn.invoke
compiler.clj:44 cljsbuild.compiler/cljsbuild.compiler.SourcePaths
closure.clj:1018 cljs.closure/build
closure.clj:972 cljs.closure/build
compiler.clj:58 cljsbuild.compiler/compile-cljs[fn]
compiler.clj:57 cljsbuild.compiler/compile-cljs
compiler.clj:159 cljsbuild.compiler/run-compiler
form-init1706317005734214457.clj:1 user/eval3512[fn]
form-init1706317005734214457.clj:1 user/eval3512[fn]
LazySeq.java:40 clojure.lang.LazySeq.sval
LazySeq.java:49 clojure.lang.LazySeq.seq
RT.java:484 clojure.lang.RT.seq
core.clj:133 clojure.core/seq
core.clj:2855 clojure.core/dorun
core.clj:2871 clojure.core/doall
form-init1706317005734214457.clj:1 user/eval3512
Compiler.java:6703 clojure.lang.Compiler.eval
Compiler.java:6693 clojure.lang.Compiler.eval
Compiler.java:7130 clojure.lang.Compiler.load
Compiler.java:7086 clojure.lang.Compiler.loadFile
main.clj:274 clojure.main/load-script
main.clj:279 clojure.main/init-opt
main.clj:307 clojure.main/initialize
main.clj:342 clojure.main/null-opt
main.clj:420 clojure.main/main
RestFn.java:421 clojure.lang.RestFn.invoke
Var.java:383 clojure.lang.Var.invoke
AFn.java:156 clojure.lang.AFn.applyToHelper
Var.java:700 clojure.lang.Var.applyTo
main.java:37 clojure.main.main
Caused by: clojure.lang.ExceptionInfo: No such namespace: test.model.dimension-glossary-test at line 1 test/test_suite.cljs
core.clj:4403 clojure.core/ex-info
analyzer.clj:297 cljs.analyzer/error
analyzer.clj:294 cljs.analyzer/error
analyzer.clj:1095 cljs.analyzer/analyze-deps
analyzer.clj:1280 cljs.analyzer/eval1561[fn]
MultiFn.java:249 clojure.lang.MultiFn.invoke
analyzer.clj:1609 cljs.analyzer/analyze-seq
analyzer.clj:1696 cljs.analyzer/analyze[fn]
analyzer.clj:1689 cljs.analyzer/analyze
compiler.clj:948 cljs.compiler/compile-file*[fn]
compiler.clj:906 cljs.compiler/with-core-cljs
compiler.clj:927 cljs.compiler/compile-file*
compiler.clj:1033 cljs.compiler/compile-file

hipitihop avatar Jan 14 '15 01:01 hipitihop

So is test.model.dimension-glossary-test defined in your leiningen checkouts, or in the local project? If the former, does moving that namespace into the local project prevent the error?

cemerick avatar Jan 15 '15 11:01 cemerick

@cemerick sorry for my tardy response. test.model.dimension-glossary-test is in the main project and not part of checkouts. I have run an experiment by removing the checkouts directory altogether and this appears to have no effect.

hipitihop avatar Jan 19 '15 23:01 hipitihop

I remain unable to reproduce. Can anyone confirm this issue?

cemerick avatar May 13 '15 11:05 cemerick