lambdaisland / kaocha-cljs2

Run ClojureScript tests from Kaocha (major rewrite)
Mozilla Public License 2.0
26 stars 10 forks source link

watch mode doesn't play well with cljs reload #2

Open lucywang000 opened 4 years ago

lucywang000 commented 4 years ago

I started a kaocha watch in shadow-cljs clj-repl, so that everytime the cljs code changes the test could be auto-run.

yarn shadow-cljs clj-repl
> (kaocha.watch/run (kaocha.repl/config))

However kaocha immediately runs the tests after a file change - before shadow-cljs finishes hot reloading. So it's the old code that gets tested, not the most recent version.

So I guess we need a way to let kaocha/chui-remote to "wait for a shadow-cljs reload event and only then run the tests".

plexus commented 4 years ago

Indeed, this is a known issue. Ideally we would hook into Shadow's reloading/watching instead of doing our own, I have some ideas on that but it requires some changes in the watch plug-in so test types can hook into it.

Valdermeyder commented 3 years ago

Another problem, I noticed with shadow-cljs watch (and even shadow-cljs server) that after the second run of tests I am getting compiler errors. It is hard to reproduce all the time but I can suspect :cloverage and/or :profiling plugins are involved because where they have used it almost always happens. In the case of a watch, I have to restart the watch. In the case of shadow-cljs server, shadow-cljs restart helps. Additionally, I have to reopen the tab where tests are open (or restart the headless browser).