This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-23
Channels
- # announcements (1)
- # architecture (20)
- # babashka (30)
- # beginners (79)
- # calva (27)
- # cider (8)
- # clj-kondo (1)
- # clojure (125)
- # clojure-australia (1)
- # clojure-berlin (4)
- # clojure-europe (62)
- # clojure-france (1)
- # clojure-italy (6)
- # clojure-nl (4)
- # clojure-uk (12)
- # clojuredesign-podcast (5)
- # clojurescript (28)
- # core-async (31)
- # cursive (14)
- # datomic (47)
- # defnpodcast (1)
- # emacs (7)
- # figwheel-main (2)
- # fulcro (10)
- # graalvm (1)
- # graphql (11)
- # jobs-discuss (8)
- # leiningen (2)
- # off-topic (23)
- # rdf (9)
- # re-frame (3)
- # reagent (1)
- # reitit (5)
- # reveal (12)
- # shadow-cljs (12)
- # spacemacs (1)
- # tools-deps (87)
- # vim (22)
- # xtdb (21)
Trying to setup some very basic tests via shadow-cljs, but getting Uncaught ReferenceError: tests is not defined
on the runner page.
My target:
{:target :browser-test
:test-dir "resources/public/js/test"
:devtools {:http-port 8021
:http-root "resources/public/js/test"}}
My test file (in components/searchbar-test.cljs
)
(ns components.searchbar-test
(:require [cljs.test :refer (deftest is)]))
(deftest a-failing-test
(is (= 1 2)))
Test file is right next to the implementation file, and it's correctly added to the classpath AFAIK (`:source-paths ["src/main"]` defined in shadow-cljs config)
Running the tests with npx shadow-cljs watch test
my guess is that you have custom index.html
in resources/public/js/test
that calls tests.something
in a script
?
Hm, not as far as I know, all I did was the target+test file above. Seems something went wrong while I was first setting it up, removing resources/public/js/test
and restarting the watcher for the tests solved the problem. Thanks once again
I can't shadow-cljs to connect to my device (getting websocket connection error through port 9630). I've been following this https://gist.github.com/bergmannjg/461958db03c6ae41a66d264ae6504ade which tells you to forward port 8081 from Windows to WSL (for the Metro server), so I tried to do the same for port 9630 without luck. Is there any other port I should forward? Is there any way to use other protocol instead of websockets? Although there's the possibility this is a WSL2 bug, I found a related message in https://clojurians-log.clojureverse.org/shadow-cljs/2020-01-27.
I don't have a clue about the react-native bits but if you have shadow-cljs running in WSL2 then the port it is using must be reachable by your mobile
usually a good first step is just opening the browser on the mobile and trying to access the website on 9630
once you have that going and working getting it to work in your app should be straightforward
Thank you!! The suggestion to open the browser on mobile really helped me. The problem was that the shadow-cljs server and the phone live in different subnets.
The subnet for Win + WSL2 is 172.17.134.96/28
, Win using 172.17.134.97
and WSL2 using 172.17.134.106
.
The subnet for Win + phone is 192.168.0.0/24
, Win using 192.168.0.193
and the phone 192.168.0.133
.
So to solve it I had to:
1. Forward 192.168.0.193:9630
-> 172.17.134.106:9630
(Powershell's command netsh interface portproxy add v4tov4 listenport=9630 listenaddress=192.168.0.193 connectport=9630 connectaddress=172.17.134.106
).
2. Run shadow-cljs with --config-merge '{:local-ip "192.168.0.193"}'
.