Fork me on GitHub
#cljs-dev
<
2021-07-20
>
plexus08:07:15

I'll try to summarize what we are trying to do. Sorry for the wall of text... the main challenge with Chui and kaocha-cljs2 is that we want to let people decide how to compile their ClojureScript. Which tool they use (cljs.main, figwheel, lein-cljsbuild, shadow, etc), or the compiler flags (e.g. optimization level) should be up to the user. This is a lesson we learned from kaocha-cljs1. There we did the compilation ourselves (through cljs's pREPL interface), and this turned out to rule out a lot of use cases. People would rely on specific compiler settings which wouldn't be compatible with the REPL (e.g. advanced), or they would rely on shadow-specific behavior. So now the compilation is pluggable, you give us a function which handles the build step, we just ask that you include our runner into your build. When the build is done we launch a JS environment, and communicate with that runner. In order to find which tests to run the runner inspects the analyzer state (via a macro), hence why we need to make sure test namespaces have been analyzed at that point.

plexus08:07:21

The easiest solution with existing features would be that we generate a namespace with all the necessary requires and write it out to the filesystem, and ask people to include that in their builds.

dnolen13:07:30

this is why I suggested -e

dnolen13:07:51

the problem is there is no :main - but we do allow compiling directories - and this might be the use case for that

dnolen13:07:20

so test directory compile + -e and you could have macro that finds everything etc. and runs