hi, i'm using figwheel-main with deps.edn and trying to get command line tests working with the standard test_runner. I am getting an error that it cannot find my test-runner even though i have "test" as an "extra-paths" and the filename has an underscore where the hyphen is.
Namespace redacted.test-runner/redacted.test-runner does not exist
my filesystem structure is: <project_root>/test/redacted/test_runner.cljs
and that file contains the standard boilerplate for a test runner.
here is my deps.edn snippet:
:test {:extra-paths ["test"]
:main-opts ["-m" "figwheel.main" "-m" redacted.test-runner]
can anyone help?
@bhauman ^^
@johanatan that error is strange it says redacted.test-runner/redacted.test-runner
yep, it is strange π
is this just a ClojureScript compile error?
i change the deps.edn to be: redacted.test-runnerzzz and the zzz was repeated on both sides
i.e., it's definitely getting that token just from the deps.edn (i moved the test.cljs.edn out of the way and it isn't referenced via -co anyway)
whats in your test runner?
here's the full output:
12:07 $ clj -A:test
2020-07-31 12:07:54.932:INFO::main: Logging initialized @6157ms to org.eclipse.jetty.util.log.StdErrLog
Unexpected error (IllegalArgumentException) compiling at (REPL:1).
Namespace redacted.test-runner/redacted.test-runner does not exist. Please check that namespaces with dashes use underscores in the ClojureScript file name.
Full report at:
/var/folders/jz/920rhb8h8xj864001s7_grh80000gn/T/clojure-5208612209110040008.edn
12:08 $ cat test/redacted/test_runner.cljs
ββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β File: test/redacted/test_runner.cljs
ββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
1 β ;; This test runner is intended to be run from the command line
2 β (ns redacted.test-runner
3 β (:require
4 β ;; require all the namespaces that you want to test
5 β [redacted.proj.spec-tests]
6 β [figwheel.main.testing :refer [run-tests-async]]))
7 β
8 β (defn -main [& args]
9 β (run-tests-async 5000))
ββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
hmmm ok now just comment out run-tests-async
so that it does nothing
Iβm wondering if the macro is expanding to something bad
this seems like a pretty minimal case let me check it
@johanatan hmm I just generated a figwheel.main project and the test runner ran just fine
hmm, what else are we missing? is there some other input here that I haven't yet shared ?
i.e., something else on my system
how about my deps.edn dependency list ?
are you in the project root when you run the command?
yep, in the project root
here are my deps:
{org.clojure/clojure {:mvn/version "1.10.1"}
org.clojure/clojurescript {:mvn/version "1.10.597"}
devcards {:mvn/version "0.2.6"}
reagent {:mvn/version "0.8.1"}
re-frame {:mvn/version "0.10.8"}
re-com {:mvn/version "2.6.0"}
cljsjs/react {:mvn/version "16.8.4-0"}
cljsjs/react-dom {:mvn/version "16.8.4-0"}
cljsjs/react-popper {:mvn/version "1.0.2-0"}
cljsjs/react-transition-group {:mvn/version "4.3.0-0"}
com.andrewmcveigh/cljs-time {:mvn/version "0.5.2"}
com.gfredericks/test.chuck {:mvn/version "0.2.10"}
org.clojure/test.check {:mvn/version "0.10.0"}
clj-commons/secretary {:mvn/version "1.2.4"}
com.rpl/specter {:mvn/version "1.1.2"}
com.gfredericks/exact {:mvn/version "0.1.11"}
hiccup {:mvn/version "2.0.0-alpha2"}
precise {:mvn/version "0.1.0"}
camel-snake-kebab {:mvn/version "0.4.0"}
org.clojure/core.match {:mvn/version "0.3.0"}
<http://thi.ng/color|thi.ng/color> {:mvn/version "1.3.0"}
funcool/promesa {:mvn/version "3.0.0"}
prismatic/schema {:mvn/version "1.1.12"}
com.bhauman/figwheel-main {:mvn/version "0.2.3"}
com.bhauman/rebel-readline {:mvn/version "0.1.4"}
com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}
nrepl/nrepl {:mvn/version "0.6.0"}
cider/cider-nrepl {:mvn/version "0.22.1"}
cider/piggieback {:mvn/version "0.4.1"}
akiroz.re-frame/storage {:mvn/version "0.1.4"}
testdouble/clojurescript.csv {:mvn/version "0.4.5"}
cljsjs/proj4 {:mvn/version "2.5.0-0"}
day8.re-frame/http-fx {:mvn/version "0.1.6"}
re-frame-utils {:mvn/version "0.1.0"}
day8.re-frame/re-frame-10x {:mvn/version "0.4.2"}}
and paths:
:paths ["src" "resources"]
and you are running clojure -A:test
clj -A:test
actually
does it need to be clojure
?
that works
are you using the very latest clojure tools, because they just mae some big changes
no, i haven't updated in a while
and have had this problem for 6 months at least. just now getting around to trying to diagnose it
did you try clojure -m figwheel.main -m redacted.test-runner
yea, i tried that a while ago. let me try again
hmmm thatβs a really old version of figwheel
oh hmm. perhaps i should upgrade?
try 0.2.11
k
and make sure you delete all the output files
thereβs a new --clean flag
target/
or something else?
target
k
oops, hmm, i get a different error now
Error in command line args
-- Spec failed --------------------
["-m" "redacted.test-runner/redacted.test-runner"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
should be a CLJS namespace available on the classpath
__ Doc for -m --main _____
Call the -main function from a namespace with args
-------------------------
Detected 1 error
actually same error, different / better formatting
actually
thatβs very strange
ok now just try it on the command line
clj -m figwheel.main -m redactedβ¦
ok, just a sec
back to the original error format
hmm, actually slight difference
12:28 $ clojure -m figwheel.main -m redacted.test-runner
2020-07-31 12:28:31.570:INFO::main: Logging initialized @6269ms to org.eclipse.jetty.util.log.StdErrLog
Unexpected error (IllegalArgumentException) compiling at (REPL:1).
Namespace redacted.test-runner does not exist. Please check that namespaces with dashes use underscores in the ClojureScript file name.
Full report at:
/var/folders/jz/920rhb8h8xj864001s7_grh80000gn/T/clojure-6073873970012598693.edn
ahhhh
do i need to specify the "test" path somehow ?
interesting
yes
comment out the opts part of your test alias
somehow deps is munging your namespace
does it matter that "redacted" actually contains a number ?
like "redacted5"
no idea
hehe
but something is super wacky
@johanatan if you create an alias to just add the test path it should work
so... clojure -A:test -m figwheel.main -m redacted.test-runner
where the test alias only modifies path ?
yes
oh shit
your redacted.test-runner in your deps.edn file needs to have quotes around it
ah!
clojure -A:test -m figwheel.main -m rapid7.test-runner
<< this actually did work
yes, quotes in deps.edn worked
π
i had tried 'redacted.test-runner
but didn't think to try "redacted.test-runner"
sorry for the huge time waste. i was afraid it was something simple like this
anyway, thanks so much for your help! @bhauman
how do we prevent the "eval timed out!" error? my tests successfully run (based on output i'm seeing in the browser's console log) but i always get the following error in the actual command line:
13:10 $ clj -A:test
2020-07-31 13:10:22.336:INFO::main: Logging initialized @5506ms to org.eclipse.jetty.util.log.StdErrLog
[Figwheel] Validating figwheel-main.edn
[Figwheel] figwheel-main.edn is valid \(γ)/
[Figwheel] Compiling build test to "target/public/cljs-out/test-main.js"
[Figwheel] Successfully compiled build test to "target/public/cljs-out/test-main.js" in 14.239 seconds.
Opening URL <http://localhost:9500>
Eval timed out!
No stacktrace available.
Execution error (ExceptionInfo) at cljs.repl/evaluate-form (repl.cljc:578).
Eval timed out!
Full report at:
/var/folders/jz/920rhb8h8xj864001s7_grh80000gn/T/clojure-2697828571253767923.edn
(i tried both run-tests
and run-test-async
[the latter with a very high timeout value])
@johanatan you have to give it a bigger timeout!
change 5000 to something bigger
I gave it 120000 and yet the timeout occurred within 20 secs
And also the problem occurred with the synchronous version as well
oh weird
oh the repl has a timeout
letβs see
@johanatan there is a :repl-eval-timeout that you can set in figwheel options
not sure if that will do it
oh and BTW there is a #figwheel-main channel thats probably better for this
Hehe ok.
Will migrate the conversation over to there if there is still a need after trying :repl-eval-timeout