lambdaisland / kaocha-cljs

ClojureScript support for Kaocha
Eclipse Public License 1.0
40 stars 9 forks source link

Avoiding browser relaunch? #12

Closed gmp26 closed 1 year ago

gmp26 commented 5 years ago

When running bin/kaocha :unit-cljs --watch, every source change launches a new browser window on http://localhost:9000/?rel=xxxxxxx.

Is there any way to avoid or configure this behaviour?

countgizmo commented 5 years ago

@gmp26 I was able to configure the browser repl through tests.edn config like this:

#kaocha/v1
{:tests [{:id                    :my-cljs-test
          :type                  :kaocha.type/cljs
          :cljs/repl-env         cljs.repl.browser/repl-env
          :cljs/compiler-options {:port           9000
                                  :launch-browser false}}]}

As I understand you can add other repl-env options described here to the comipler-options map.

plexus commented 5 years ago

That's a great solution! Thanks for sharing.

gmp26 commented 5 years ago

Thanks @countgizmo. Just been trying that and although it does prevent a browser being launched, I can only get the tests to work if I manually launch a browser window shortly after launching a single test run. It doesn't help with '--watch' as subsequent tests don't reconnect to the running window successfully, so you end up with this:

Exception: clojure.lang.ExceptionInfo: Kaocha ClojureScript client failed connecting back.
plexus commented 5 years ago

I was afraid this would be the case. Someone will have to hack the browser repl-env to be smarter about reconnecting, until then opening new windows/tabs or running on node or the main options.

gmp26 commented 5 years ago

@plexus, OK, thanks - node is working for me in this case as I'm not currently testing anything domish, and I guess I can live with the browser relaunch when I do go there. Feel free to close.

alysbrooks commented 1 year ago

We'd welcome an alternative repl-env but I don't think developing it will be a priority for us.