kaocha-cljs icon indicating copy to clipboard operation
kaocha-cljs copied to clipboard

Avoiding browser relaunch?

Open gmp26 opened this issue 5 years ago • 5 comments

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?

gmp26 avatar Jun 05 '19 13:06 gmp26

@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.

countgizmo avatar Jun 06 '19 09:06 countgizmo

That's a great solution! Thanks for sharing.

plexus avatar Jun 06 '19 12:06 plexus

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.

gmp26 avatar Jun 06 '19 13:06 gmp26

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.

plexus avatar Jun 06 '19 13:06 plexus

@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.

gmp26 avatar Jun 06 '19 13:06 gmp26

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

alysbrooks avatar Jul 07 '23 21:07 alysbrooks