clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
anonimitoraf 2020-11-15T08:26:07.223700Z

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:

anonimitoraf 2020-11-15T08:27:18.224400Z

My reitit routes look like:

[["/" :root]
 ["/auth"
  ["/post-sign-in" :auth/post-sign-in]]

thheller 2020-11-15T09:59:12.225300Z

@nicdaoraf it should be &lt;script src="/js/compiled/app.js"&gt;&lt;/script&gt;. without the leading slash it'll use the basepath of the current page which will be <http://localhost:8280/auth/> + the src

anonimitoraf 2020-11-15T10:00:57.225700Z

oh wow. Thanks a lot! That worked

Erkan 2020-11-15T18:32:02.228300Z

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.

thheller 2020-11-15T19:34:59.228700Z

@hallstrom.eric works just fine for me?

cljs.user=&gt; (require '[cljs.test :as ct])
nil
&gt; (defn foo {:test #(ct/is (= 1 2))} [a b])
#object[Function]
&gt; (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

thheller 2020-11-15T19:35:38.229100Z

(that is via shadow-cljs browser-repl but everything else should work the same)

Erkan 2020-11-15T19:59:16.229200Z

Hmm ok, I'm trying to run it through cursive repl that I've connected to shadow-cljs watch app

thheller 2020-11-15T20:00:00.229400Z

should be fine too

Erkan 2020-11-15T20:08:54.229600Z

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)

Erkan 2020-11-15T20:09:19.229800Z

but just when I'm typing this I found out that cljs.test/ruun-tests 'my-namespace was needed ...!

thheller 2020-11-15T20:09:45.230Z

maybe you want run-all-tests? otherwise run-tests defaults to running tests in the current ns

Erkan 2020-11-15T20:10:50.230200Z

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

thheller 2020-11-15T20:11:13.230400Z

it should if you actually switch to that ns

Erkan 2020-11-15T20:13:49.230600Z

I see, must have missed that, Can I print the current namespace somehow?

thheller 2020-11-15T20:14:16.230800Z

Cursive shows it in the bottom right?

thheller 2020-11-15T20:14:29.231Z

otherwise just ::foo also works to get the ns

Erkan 2020-11-15T20:15:11.231300Z

dam you are right, it does!

Erkan 2020-11-15T20:15:59.231500Z

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

👍 1