Fork me on GitHub

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?


its not shadow-cljs doing this


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


Alright, someone here trying the WSL2 + react-native combo? Or at least only WSL2?


I can't shadow-cljs to connect to my device (getting websocket connection error through port 9630). I've been following this 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


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


its only port 9630 (or 9631++ if those are used)


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 , Win using and WSL2 using The subnet for Win + phone is, Win using and the phone So to solve it I had to: 1. Forward -> (Powershell's command netsh interface portproxy add v4tov4 listenport=9630 listenaddress= connectport=9630 connectaddress= 2. Run shadow-cljs with --config-merge '{:local-ip ""}' .

👍 3