Hey guys. Working on my first Clojurescript project and I've come across something weird.
Basically:
• Going to <http://localhost:8280>
is fine
• Going to <http://localhost:8280/auth/post-sign-in>
isn't fine.
I get GET <http://localhost:8280/auth/js/compiled/app.js> net::ERR_ABORTED 404 (Not Found)
In my project.clj
I have:
:builds {:app {:target :browser
:output-to "resources/public/js/compiled/app.js"
:output-dir "resources/public/js/compiled/out"
:asset-path "/js/compiled/out"
...}
:devtools {:http-root "resources/public" :http-port 8280}
In index.html
, I have:
<script src="js/compiled/app.js"></script>
My folder structure looks like this:My reitit routes look like:
[["/" :root]
["/auth"
["/post-sign-in" :auth/post-sign-in]]
@nicdaoraf it should be <script src="/js/compiled/app.js"></script>
. without the leading slash it'll use the basepath of the current page which will be <http://localhost:8280/auth/>
+ the src
oh wow. Thanks a lot! That worked
Has anyone succeeded with running inline tests under :test metadata tag of a function in shadow-cljs? (cljs.test/run-tests)
seems to not pick up any of my inline tests.
@hallstrom.eric works just fine for me?
cljs.user=> (require '[cljs.test :as ct])
nil
> (defn foo {:test #(ct/is (= 1 2))} [a b])
#object[Function]
> (ct/run-tests)
Testing cljs.user
FAIL in (foo) (repl-input.cljs:1:26)
expected: (= 1 2)
actual: (not (= 1 2))
Ran 1 tests containing 1 assertions.
1 failures, 0 errors.
nil
(that is via shadow-cljs browser-repl
but everything else should work the same)
Hmm ok, I'm trying to run it through cursive repl that I've connected to shadow-cljs watch app
should be fine too
thats my problem, it seems to not work :~|, I'm running shadow-cljs watch app
and then from cursive remote REPL connected to that nrepl: (shadow/watch :app)
(shadow/repl :app)
and then (cljs.tests/run-tests)
but just when I'm typing this I found out that cljs.test/ruun-tests 'my-namespace
was needed ...!
maybe you want run-all-tests
? otherwise run-tests
defaults to running tests in the current ns
ye, I just wanted to run the tests in the current namespace but doing (cljs.test/run-test)
without arguments didn't pick up any
it should if you actually switch to that ns
I see, must have missed that, Can I print the current namespace somehow?
Cursive shows it in the bottom right?
otherwise just ::foo
also works to get the ns
dam you are right, it does!
just managed to port my figwheel project to shadow-cljs and it's awesome! thank you so much @thheller for all the work you do