Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No such namespace exception #4

Open
borkdude opened this issue Jan 30, 2019 · 6 comments
Open

No such namespace exception #4

borkdude opened this issue Jan 30, 2019 · 6 comments
Labels
closed:wontfix This will not be worked on

Comments

@borkdude
Copy link

borkdude commented Jan 30, 2019

Repro:

$ cat deps.edn
{:aliases {:test {:extra-deps {lambdaisland/kaocha {:mvn/version "0.0-389"}
                               lambdaisland/kaocha-cljs {:mvn/version "0.0-16"}}}}}

$ cat tests.edn
#kaocha/v1
{:tests [{:id :unit-cljs
          :type :kaocha.type/cljs}]}

$ cat test/repro/core_test.cljs
(ns repro.core-test
  (:require [clojure.test :as t]))

(t/deftest foo
  (t/is true))

$  npm i isomorphic-ws ws --save
npm WARN saveError ENOENT: no such file or directory, open '/Users/Borkdude/temp/repro/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/Borkdude/temp/repro/package.json'
npm WARN repro No description
npm WARN repro No repository field.
npm WARN repro No README data
npm WARN repro No license field.

+ [email protected]
+ [email protected]
updated 2 packages and audited 4 packages in 1.029s
found 0 vulnerabilities

$ clojure -A:test -m kaocha.runner --no-capture-output$ clojure -A:test -m kaocha.runner --no-capture-output
WARNING: symbol already refers to: #'clojure.core/symbol in namespace: kaocha.type.cljs, being replaced by: #'kaocha.core-ext/symbol
[(Exception in thread "main" clojure.lang.ExceptionInfo: ClojureScript Exception {:via [{:type clojure.lang.ExceptionInfo, :message "No such namespace: repro.core-test, could not locate repro/core_test.cljs, repro/core_test.cljc, or JavaScript source providing \"repro.core-test\" (Please check that namespaces with dashes use underscores in the ClojureScript file name) at line 2 <cljs repl>", :data {:file "<cljs repl>", :line 2, :column 1, :root-source-info {:source-type :fragment, :source-form (require (quote repro.core-test))}, :tag :cljs/analysis-error}, :at [cljs.analyzer$error invokeStatic "analyzer.cljc" 718]}], :trace [[cljs.analyzer$error invokeStatic "analyzer.cljc" 718] [cljs.analyzer$error invoke "analyzer.cljc" 714] [cljs.analyzer$error invokeStatic "analyzer.cljc" 716] [cljs.analyzer$error invoke "analyzer.cljc" 714] [cljs.analyzer$analyze_deps invokeStatic "analyzer.cljc" 2338] [cljs.analyzer$analyze_deps invoke "analyzer.cljc" 2312] [cljs.analyzer$ns_side_effects invokeStatic "analyzer.cljc" 3742] [cljs.analyzer$ns_side_effects invoke "analyzer.cljc" 3737] [cljs.analyzer$analyze_STAR_$fn__2629 invoke "analyzer.cljc" 3861] [clojure.lang.PersistentVector reduce "PersistentVector.java" 343] [clojure.core$reduce invokeStatic "core.clj" 6827] [clojure.core$reduce invoke "core.clj" 6810] [cljs.analyzer$analyze_STAR_ invokeStatic "analyzer.cljc" 3861] [cljs.analyzer$analyze_STAR_ invoke "analyzer.cljc" 3851] [cljs.analyzer$analyze invokeStatic "analyzer.cljc" 3880] [cljs.analyzer$analyze invoke "analyzer.cljc" 3863] [cljs.analyzer$analyze_seq invokeStatic "analyzer.cljc" 3630] [cljs.analyzer$analyze_seq invoke "analyzer.cljc" 3607] [cljs.analyzer$analyze_form invokeStatic "analyzer.cljc" 3810] [cljs.analyzer$analyze_form invoke "analyzer.cljc" 3807] [cljs.analyzer$analyze_STAR_ invokeStatic "analyzer.cljc" 3860] [cljs.analyzer$analyze_STAR_ invoke "analyzer.cljc" 3851] [cljs.analyzer$analyze invokeStatic "analyzer.cljc" 3880] [cljs.analyzer$analyze invoke "analyzer.cljc" 3863] [cljs.repl$evaluate_form$fn__6550 invoke "repl.cljc" 558] [cljs.repl$evaluate_form invokeStatic "repl.cljc" 557] [cljs.repl$evaluate_form invoke "repl.cljc" 499] [cljs.repl$eval_cljs invokeStatic "repl.cljc" 689] [cljs.repl$eval_cljs invoke "repl.cljc" 682] [cljs.core.server$prepl$fn__3549$fn__3554 invoke "server.clj" 108] [cljs.core.server$prepl$fn__3549 invoke "server.clj" 91] [cljs.compiler$with_core_cljs invokeStatic "compiler.cljc" 1416] [cljs.compiler$with_core_cljs invoke "compiler.cljc" 1405] [cljs.core.server$prepl invokeStatic "server.clj" 77] [cljs.core.server$prepl doInvoke "server.clj" 39] [clojure.lang.RestFn invoke "RestFn.java" 470] [kaocha.cljs.prepl$prepl$fn__3619 invoke "prepl.clj" 65] [clojure.core$binding_conveyor_fn$fn__5739 invoke "core.clj" 2030] [clojure.lang.AFn call "AFn.java" 18] [java.util.concurrent.FutureTask run "FutureTask.java" 266] [java.util.concurrent.ThreadPoolExecutor runWorker "ThreadPoolExecutor.java" 1149] [java.util.concurrent.ThreadPoolExecutor$Worker run "ThreadPoolExecutor.java" 624] [java.lang.Thread run "Thread.java" 748]], :cause "No such namespace: repro.core-test, could not locate repro/core_test.cljs, repro/core_test.cljc, or JavaScript source providing \"repro.core-test\" (Please check that namespaces with dashes use underscores in the ClojureScript file name) at line 2 <cljs repl>", :data {:file "<cljs repl>", :line 2, :column 1, :root-source-info {:source-type :fragment, :source-form (require (quote repro.core-test))}, :tag :cljs/analysis-error}}
	at kaocha.type.cljs$fn__6606.invokeStatic(cljs.clj:125)
	at kaocha.type.cljs$fn__6606.invoke(cljs.clj:123)
	at kaocha.type.cljs$queue_consumer.invokeStatic(cljs.clj:161)
	at kaocha.type.cljs$queue_consumer.invoke(cljs.clj:147)
	at kaocha.type.cljs$eval6667$fn__6669.invoke(cljs.clj:263)
	at clojure.lang.MultiFn.invoke(MultiFn.java:234)
	at kaocha.testable$run.invokeStatic(testable.clj:108)
	at kaocha.testable$run.invoke(testable.clj:99)
	at clojure.lang.AFn.applyToHelper(AFn.java:156)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at orchestra.spec.test$spec_checking_fn$fn__3113.doInvoke(test.clj:125)
	at clojure.lang.RestFn.invoke(RestFn.java:421)
	at kaocha.testable$run_testable.invokeStatic(testable.clj:160)
	at kaocha.testable$run_testable.invoke(testable.clj:137)
	at kaocha.testable$run_testables.invokeStatic(testable.clj:169)
	at kaocha.testable$run_testables.invoke(testable.clj:163)
	at kaocha.type.cljs$eval6633$fn__6635.invoke(cljs.clj:216)
	at clojure.lang.MultiFn.invoke(MultiFn.java:234)
	at kaocha.testable$run.invokeStatic(testable.clj:108)
	at kaocha.testable$run.invoke(testable.clj:99)
	at clojure.lang.AFn.applyToHelper(AFn.java:156)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at orchestra.spec.test$spec_checking_fn$fn__3113.doInvoke(test.clj:125)
	at clojure.lang.RestFn.invoke(RestFn.java:421)
	at kaocha.testable$run_testable.invokeStatic(testable.clj:160)
	at kaocha.testable$run_testable.invoke(testable.clj:137)
	at kaocha.testable$run_testables.invokeStatic(testable.clj:169)
	at kaocha.testable$run_testables.invoke(testable.clj:163)
	at kaocha.api$run$fn__3061.invoke(api.clj:96)
	at clojure.core$with_redefs_fn.invokeStatic(core.clj:7514)
	at clojure.core$with_redefs_fn.invoke(core.clj:7498)
	at kaocha.api$run.invokeStatic(api.clj:88)
	at kaocha.api$run.invoke(api.clj:71)
	at kaocha.runner$run.invokeStatic(runner.clj:118)
	at kaocha.runner$run.invoke(runner.clj:68)
	at kaocha.runner$_main_STAR_.invokeStatic(runner.clj:136)
	at kaocha.runner$_main_STAR_.doInvoke(runner.clj:122)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.core$apply.invokeStatic(core.clj:665)
	at clojure.core$apply.invoke(core.clj:660)
	at kaocha.runner$_main.invokeStatic(runner.clj:147)
	at kaocha.runner$_main.doInvoke(runner.clj:145)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.Var.applyTo(Var.java:705)
	at clojure.core$apply.invokeStatic(core.clj:665)
	at clojure.main$main_opt.invokeStatic(main.clj:491)
	at clojure.main$main_opt.invoke(main.clj:487)
	at clojure.main$main.invokeStatic(main.clj:598)
	at clojure.main$main.doInvoke(main.clj:561)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.Var.applyTo(Var.java:705)
	at clojure.main.main(main.java:37)
@plexus
Copy link
Member

plexus commented Jan 31, 2019

Sorry about this, this is actually a known issue but I only had it in my personal notes. You need to manually add :paths ["test"] to deps.edn, the dynamic classpath handling does not get picked up by ClojureScript.

@borkdude
Copy link
Author

Thanks! This workaround gets me a different error:

$ bin/kaocha
WARNING: symbol already refers to: #'clojure.core/symbol in namespace: kaocha.type.cljs, being replaced by: #'kaocha.core-ext/symbol
[(Exception in thread "main" clojure.lang.ExceptionInfo: Timeout loading ClojureScript namespace speculative_kaocha.unit {:kaocha.test-plan/tests ({:kaocha.testable/type :kaocha.type.cljs/test, :kaocha.testable/id :cljs:speculative_kaocha.unit/instrumented-test, :kaocha.testable/desc "instrumented-test", :kaocha.testable/meta {:file "/Users/Borkdude/Dropbox/dev/clojure/speculative-kaocha-plugin/test/speculative_kaocha/unit.cljc", :line 6, :column 10, :end-line 6, :end-column 27}, :kaocha.type.cljs/test speculative_kaocha.unit/instrumented-test, :kaocha.plugin.randomize/sort-key 217678479}), :kaocha.plugin.randomize/sort-key 128119952, :kaocha.type.cljs/ns speculative_kaocha.unit, :kaocha.testable/meta nil, :kaocha.type.cljs/file #object[java.io.File 0x9e4388d "test/speculative_kaocha/unit.cljc"], :kaocha.testable/type :kaocha.type.cljs/ns, :kaocha.type.cljs/timeout 10000, :kaocha.testable/desc "speculative_kaocha.unit", :kaocha.type.cljs/queue #object[java.util.concurrent.LinkedBlockingQueue 0x21399e53 "[{:type :kaocha.cljs.websocket-server/disconnect, :client #object[org.httpkit.server.AsyncChannel 0x28532753 \"0.0.0.0/0.0.0.0:9753<->null\"]}]"], :kaocha.type.cljs/eval #object[kaocha.cljs.prepl$prepl$eval__4746 0x260043d "kaocha.cljs.prepl$prepl$eval__4746@260043d"], :kaocha.testable/id :cljs:speculative_kaocha.unit}

Note that cljs.main and https://github.com/Olical/cljs-test-runner do work with extra-paths from aliases.

@nenadalm
Copy link

nenadalm commented Aug 2, 2019

Hi. How can I configure compiler options? I am getting this exception:

... No such namespace: jsonwebtoken, could not locate jsonwebtoken.cljs, jsonwebtoken.cljc, or JavaScript source providing "jsonwebtoken" in file ...

jsonwebtoken is js dependency present int ./node_modules

;; tests.edn
#kaocha/v1
{:tests [{:id :unit-cljs
          :type :kaocha.type/cljs
          :test-paths ["test"]
          :cljs/compiler-options {:npm-deps {}
                                  :target :nodejs
                                  :optimizations :none}}]}
;; leiningen profile
{:kaocha {:source-paths ["src" "test"]
            :dependencies [[lambdaisland/kaocha "0.0-529"]
                           [lambdaisland/kaocha-cljs "0.0-40"]]}}

;; leiningen alias
{"kaocha" ["with-profile" "kaocha" "run" "-m" "kaocha.runner" "unit-cljs"]}

I wanted to try Kaocha instead of lein-doo where following compiler configuration works:

{:main app.run-all
 :output-to "target/test/app.js"
 :output-dir "target/test"
 :target :nodejs
 :npm-deps {}
 :optimizations :none
 :pretty-print true
 :source-map true}

@nenadalm
Copy link

nenadalm commented Aug 2, 2019

here is the exception to the previous post:

 lein kaocha
Warning: implicit hook found: lein-npm.plugin/hooks 
Hooks are deprecated and will be removed in a future version.
[E]
Randomized with --seed 594234660

ERROR in unit-cljs (analyzer.cljc:4128)
Exception: clojure.lang.ExceptionInfo: null
#:clojure.error{:source nil, :line nil, :column nil, :phase :compilation}
 at cljs.analyzer$analyze.invokeStatic (analyzer.cljc:4128)
    cljs.analyzer$analyze.invoke (analyzer.cljc:4114)
    cljs.analyzer$analyze_file$fn__2777.invoke (analyzer.cljc:4634)
    cljs.analyzer$analyze_file.invokeStatic (analyzer.cljc:4629)
    cljs.analyzer$analyze_file.invoke (analyzer.cljc:4587)
    cljs.analyzer$analyze_file.invokeStatic (analyzer.cljc:4601)
    cljs.analyzer$analyze_file.invoke (analyzer.cljc:4587)
    cljs.analyzer$analyze_deps.invokeStatic (analyzer.cljc:2565)
    cljs.analyzer$analyze_deps.invoke (analyzer.cljc:2541)
    cljs.analyzer$ns_side_effects.invokeStatic (analyzer.cljc:3993)
    cljs.analyzer$ns_side_effects.invoke (analyzer.cljc:3988)
    cljs.analyzer$analyze_STAR_$fn__2657.invoke (analyzer.cljc:4112)
    ...
    cljs.analyzer$analyze_STAR_.invokeStatic (analyzer.cljc:4112)
    cljs.analyzer$analyze_STAR_.invoke (analyzer.cljc:4102)
    cljs.analyzer$analyze.invokeStatic (analyzer.cljc:4131)
    cljs.analyzer$analyze.invoke (analyzer.cljc:4114)
    cljs.analyzer$analyze_file$fn__2777.invoke (analyzer.cljc:4634)
    cljs.analyzer$analyze_file.invokeStatic (analyzer.cljc:4629)
    cljs.analyzer$analyze_file.invoke (analyzer.cljc:4587)
    cljs.analyzer$analyze_file.invokeStatic (analyzer.cljc:4601)
    cljs.analyzer$analyze_file.invoke (analyzer.cljc:4587)
    cljs.analyzer$analyze_file.invokeStatic (analyzer.cljc:4597)
    cljs.analyzer$analyze_file.invoke (analyzer.cljc:4587)
    kaocha.type.cljs$eval6605$fn__6606.invoke (cljs.clj:84)
    ...
    kaocha.testable$load.invokeStatic (testable.clj:77)
    kaocha.testable$load.invoke (testable.clj:64)
    ...
    kaocha.testable$load_testables.invokeStatic (testable.clj:142)
    kaocha.testable$load_testables.invoke (testable.clj:134)
    kaocha.type.cljs$eval6591$fn__6592$fn__6595$fn__6596.invoke (cljs.clj:79)
    cljs.compiler$with_core_cljs.invokeStatic (compiler.cljc:1417)
    cljs.compiler$with_core_cljs.invoke (compiler.cljc:1406)
    kaocha.type.cljs$eval6591$fn__6592$fn__6595.invoke (cljs.clj:77)
    kaocha.type.cljs$eval6591$fn__6592.invoke (cljs.clj:76)
    ...
    kaocha.testable$load.invokeStatic (testable.clj:77)
    kaocha.testable$load.invoke (testable.clj:64)
    ...
    kaocha.testable$load_testables.invokeStatic (testable.clj:142)
    kaocha.testable$load_testables.invoke (testable.clj:134)
    kaocha.api$test_plan.invokeStatic (api.clj:41)
    kaocha.api$test_plan.invoke (api.clj:34)
    kaocha.api$run$fn__3059.invoke (api.clj:85)
    ...
    kaocha.api$run.invokeStatic (api.clj:83)
    kaocha.api$run.invoke (api.clj:71)
    kaocha.runner$run.invokeStatic (runner.clj:126)
    kaocha.runner$run.invoke (runner.clj:68)
    kaocha.runner$_main_STAR_.invokeStatic (runner.clj:156)
    kaocha.runner$_main_STAR_.doInvoke (runner.clj:138)
    ...
    kaocha.runner$_main.invokeStatic (runner.clj:167)
    kaocha.runner$_main.doInvoke (runner.clj:165)
    ...
    user$eval140.invokeStatic (form-init541779216517326435.clj:1)
    user$eval140.invoke (form-init541779216517326435.clj:1)
    ...
Caused by: clojure.lang.ExceptionInfo: No such namespace: jsonwebtoken, could not locate jsonwebtoken.cljs, jsonwebtoken.cljc, or JavaScript source providing "jsonwebtoken" in file /project/src/app/routes/middleware/auth.cljs
{:tag :cljs/analysis-error}
 at cljs.analyzer$error.invokeStatic (analyzer.cljc:751)
    cljs.analyzer$error.invoke (analyzer.cljc:747)
    cljs.analyzer$error.invokeStatic (analyzer.cljc:749)
    cljs.analyzer$error.invoke (analyzer.cljc:747)
    cljs.analyzer$analyze_deps.invokeStatic (analyzer.cljc:2567)
    cljs.analyzer$analyze_deps.invoke (analyzer.cljc:2541)
    cljs.analyzer$ns_side_effects.invokeStatic (analyzer.cljc:3993)
    cljs.analyzer$ns_side_effects.invoke (analyzer.cljc:3988)
    cljs.analyzer$analyze_STAR_$fn__2657.invoke (analyzer.cljc:4112)
    ...
    cljs.analyzer$analyze_STAR_.invokeStatic (analyzer.cljc:4112)
    cljs.analyzer$analyze_STAR_.invoke (analyzer.cljc:4102)
    cljs.analyzer$analyze.invokeStatic (analyzer.cljc:4131)
    cljs.analyzer$analyze.invoke (analyzer.cljc:4114)
    cljs.analyzer$analyze_file$fn__2777.invoke (analyzer.cljc:4634)
    cljs.analyzer$analyze_file.invokeStatic (analyzer.cljc:4629)
    cljs.analyzer$analyze_file.invoke (analyzer.cljc:4587)
    cljs.analyzer$analyze_file.invokeStatic (analyzer.cljc:4601)
    cljs.analyzer$analyze_file.invoke (analyzer.cljc:4587)
    cljs.analyzer$analyze_deps.invokeStatic (analyzer.cljc:2565)
    cljs.analyzer$analyze_deps.invoke (analyzer.cljc:2541)
    cljs.analyzer$ns_side_effects.invokeStatic (analyzer.cljc:3993)
    cljs.analyzer$ns_side_effects.invoke (analyzer.cljc:3988)
    cljs.analyzer$analyze_STAR_$fn__2657.invoke (analyzer.cljc:4112)
    ...
    cljs.analyzer$analyze_STAR_.invokeStatic (analyzer.cljc:4112)
    cljs.analyzer$analyze_STAR_.invoke (analyzer.cljc:4102)
    cljs.analyzer$analyze.invokeStatic (analyzer.cljc:4131)
    cljs.analyzer$analyze.invoke (analyzer.cljc:4114)
    cljs.analyzer$analyze_file$fn__2777.invoke (analyzer.cljc:4634)
    cljs.analyzer$analyze_file.invokeStatic (analyzer.cljc:4629)
    cljs.analyzer$analyze_file.invoke (analyzer.cljc:4587)
    cljs.analyzer$analyze_file.invokeStatic (analyzer.cljc:4601)
    cljs.analyzer$analyze_file.invoke (analyzer.cljc:4587)
    cljs.analyzer$analyze_file.invokeStatic (analyzer.cljc:4597)
    cljs.analyzer$analyze_file.invoke (analyzer.cljc:4587)
    kaocha.type.cljs$eval6605$fn__6606.invoke (cljs.clj:84)
    ...
    kaocha.testable$load.invokeStatic (testable.clj:77)
    kaocha.testable$load.invoke (testable.clj:64)
    ...
    kaocha.testable$load_testables.invokeStatic (testable.clj:142)
    kaocha.testable$load_testables.invoke (testable.clj:134)
    kaocha.type.cljs$eval6591$fn__6592$fn__6595$fn__6596.invoke (cljs.clj:79)
    cljs.compiler$with_core_cljs.invokeStatic (compiler.cljc:1417)
    cljs.compiler$with_core_cljs.invoke (compiler.cljc:1406)
    kaocha.type.cljs$eval6591$fn__6592$fn__6595.invoke (cljs.clj:77)
    kaocha.type.cljs$eval6591$fn__6592.invoke (cljs.clj:76)
    ...
    kaocha.testable$load.invokeStatic (testable.clj:77)
    kaocha.testable$load.invoke (testable.clj:64)
    ...
    kaocha.testable$load_testables.invokeStatic (testable.clj:142)
    kaocha.testable$load_testables.invoke (testable.clj:134)
    kaocha.api$test_plan.invokeStatic (api.clj:41)
    kaocha.api$test_plan.invoke (api.clj:34)
    kaocha.api$run$fn__3059.invoke (api.clj:85)
    ...
    kaocha.api$run.invokeStatic (api.clj:83)
    kaocha.api$run.invoke (api.clj:71)
    kaocha.runner$run.invokeStatic (runner.clj:126)
    kaocha.runner$run.invoke (runner.clj:68)
    kaocha.runner$_main_STAR_.invokeStatic (runner.clj:156)
    kaocha.runner$_main_STAR_.doInvoke (runner.clj:138)
    ...
    kaocha.runner$_main.invokeStatic (runner.clj:167)
    kaocha.runner$_main.doInvoke (runner.clj:165)
    ...
    user$eval140.invokeStatic (form-init541779216517326435.clj:1)
    user$eval140.invoke (form-init541779216517326435.clj:1)
    ...
1 tests, 1 assertions, 1 errors, 0 failures.
Error encountered performing task 'run' with profile(s): 'kaocha'
Suppressed exit

@countgizmo
Copy link

@nenadalm Have you tried to specify the name of the npm module in the :npm-deps map? I see you're using an empty map - maybe that's the problem.
You can see an example here:
https://clojurescript.org/reference/compiler-options#npm-deps

@nenadalm
Copy link

nenadalm commented Aug 2, 2019

@countgizmo I've tried, but with same result. As mentioned link says:

.. A node_modules directory will be indexed and used if set to a truthy value...

actual value of :npm-deps is probably important only if :install-deps is true (https://clojurescript.org/reference/compiler-options#install-deps)

@alysbrooks alysbrooks moved this from Triage to 📋 Information Needed in Lambda Island Open Source Sep 19, 2022
@lambduhh lambduhh added the closed:wontfix This will not be worked on label Mar 27, 2024
@lambduhh lambduhh moved this from 📋 Information Needed to ❌ Won't fix in Lambda Island Open Source Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed:wontfix This will not be worked on
Projects
Status: Won't fix
Development

No branches or pull requests

5 participants