kaocha

Alys Brooks 2022-04-12T00:28:03.644319Z

A new release of Kaocha, featuring bug fixes for gc-profiling and --watch: https://github.com/lambdaisland/kaocha/releases/tag/v1.65.1029

❤️ 1
cjohansen 2022-04-12T06:11:21.970489Z

I’m trying to get kaocha-cljs2 up and running, but after adding the dependency and :preloads to my build config, figwheel fails with this message:

No such namespace: platform, could not locate platform.cljs, platform.cljc, or JavaScript source providing "platform" in file resources/public/js/dev/lambdaisland/funnel_client.cljs

   3              [cognitect.transit :as transit]
   4              [goog.object :as gobj]
   5              [lambdaisland.funnel-client.random-id :as random-id]
   6              [lambdaisland.funnel-client.websocket :as websocket]
   7              [lambdaisland.glogi :as log]
   8              [platform :as platform])
                   ^---

plexus 2022-04-12T14:27:34.492299Z

@christian767 did you find this repo? it contains a complete working example of kaocha-cljs2 https://github.com/plexus/cljs-test-example

plexus 2022-04-12T14:27:51.900659Z

these are the npm packages we install, agreed that this should be documented: https://github.com/plexus/cljs-test-example/blob/main/shadow-browser-kaocha-cljs2/package.json

cjohansen 2022-04-12T14:28:13.436879Z

thanks, will have a look later!

cjohansen 2022-04-12T14:28:20.857039Z

I only followed the kaocha-cljs2 readme

plexus 2022-04-12T14:30:08.326359Z

Doc PRs would be super welcome, we never had the chance to properly polish this stuff up. I recently started this example repo so at a minimum people can look at a fully working example and copy bits over.

cjohansen 2022-04-12T14:31:02.162129Z

I’ll see what I can do if I manage to get it running

plexus 2022-04-12T14:37:53.978189Z

note that funnel-client has a deps.cljs which mentions platform, so depending on your cljs build tooling that should get pulled in automatically

plexus 2022-04-12T14:38:21.972459Z

and stacktrace-js / stack-trace are in the deps.cljs of chui-core

cjohansen 2022-04-12T15:17:07.173239Z

they didn’t

cjohansen 2022-04-12T15:17:25.620229Z

I’m using figwheel, with what I imagine is pretty vanilla config

plexus 2022-04-13T04:12:04.445239Z

You're in unexplored territory then. Adding : install-deps true to your cljs config may help

cjohansen 2022-04-13T06:24:53.332299Z

Adding that installed the deps for me, but I still have runtime errors when I run the build.

cjohansen 2022-04-13T06:25:50.660629Z

I looked at the example repo. I see all the examples use shadow-cljs. I don’t know anything about shadow, so translating to my setup will involve rabbit holing into shadow which is a little out of scope right now 😅

oxalorg (Mitesh) 2022-04-12T06:15:00.221619Z

Can you try after doing an npm install platform

oxalorg (Mitesh) 2022-04-12T06:15:59.373989Z

or maybe "platform" :as platform

oxalorg (Mitesh) 2022-04-12T06:16:15.124029Z

I'm just guessing here, not too sure about it

cjohansen 2022-04-12T06:17:07.150309Z

Well, the dependency is in the kaocha source somwhere (funnel client from the looks of it) so I can’t change the require. But I’ll try npm installing it

oxalorg (Mitesh) 2022-04-12T06:19:05.646719Z

shadow automatically picks up npm modules, I'm not sure how it will work with figwheel though

cjohansen 2022-04-12T06:20:57.216579Z

Ok, so npm install platform gave me a new error. Then I did npm install stacktrace-js, and now figwheel compiles successfully. Those should probably be mentioned in the installation docs?

cjohansen 2022-04-12T06:21:20.232779Z

Now I have a bunch of runtime errors:

plexus 2022-04-13T09:55:01.383899Z

yeah, there's a lot of details to be figured out when trying to get it to run with a specific tool. So far we've focused on shadow-cljs because kaocha-cljs2 was created with shadow in mind, the approach for kaocha-cljs does not work for shadow. If you have a fairly vanilla clojure compiler setup than kaocha-cljs might be a better fit, it's still supported, we use it on several projects as well.

cjohansen 2022-04-13T09:55:28.568389Z

oh, ok

plexus 2022-04-13T09:55:44.112539Z

The plan is to expand that repo with more examples, there's a lot of permutations of tool x runtime, I'll see if I can get a figwheel example going next

cjohansen 2022-04-13T09:56:00.124109Z

I completely understand 😅

cjohansen 2022-04-13T09:56:31.074829Z

I guess the “2” made me think it superseded the other one, that’s why redirected from kaocha-cljs to kaocha-cljs2

plexus 2022-04-13T13:02:49.847469Z

yeah, understandable. It is meant as a successor, it fixes some things that we can't fix in kaocha-cljs, but at the cost of a lot of additional complexity. Kaocha-cljs does not work for everyone, but if it works it's much easier to get going.