Fork me on GitHub
#clojurescript
<
2020-11-15
>
anonimitoraf08:11:07

Hey guys. Working on my first Clojurescript project and I've come across something weird. Basically: • Going to is fine • Going to isn't fine. I get GET 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:
My folder structure looks like this:

anonimitoraf08:11:18

My reitit routes look like:

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

thheller09:11:12

@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 + the src

anonimitoraf10:11:57

oh wow. Thanks a lot! That worked

Erkan18:11:02

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.

thheller19:11:59

@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

Erkan19:11:16

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

thheller20:11:00

should be fine too

Erkan20:11:54

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)

Erkan20:11:19

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

thheller20:11:45

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

Erkan20:11:50

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

thheller20:11:13

it should if you actually switch to that ns

Erkan20:11:49

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

thheller20:11:16

Cursive shows it in the bottom right?

thheller20:11:29

otherwise just ::foo also works to get the ns

Erkan20:11:11

dam you are right, it does!

Erkan20:11:59

just managed to port my figwheel project to shadow-cljs and it's awesome! thank you so much @U05224H0W for all the work you do

👍 3
thheller19:11:38

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