29 September 2021

Getting Started Test-driving ClojureScript

Q. So, when does it get easier? A. Right now!

I haven't published as frequently latestly. I've been buried in the early learning phase of combining ClojureScript and TDD. In the last post the goal was simply to get ClojureScript code compiling to javascript in order to manipulate a page. Mission accomplished.

The goal in preparing for this post was to come up with a minimal sample application, fully 'kitted out' with Speclj (our testing library/runner of choice) and already rendering a simple 'hello-world' React component to the browser. Mission accomplished!

Behold: https://github.com/mdwhatcott/cljs-sample-project

The README of that project should have everything you need to instantly get started writing ClojureScript, but also enough explanation to understand each of the moving parts, at least at a superficial level (which is probably where I'm at right now, to be fair).

Along the way I drew inspiration from Eric Smith, a Crafter at 8th Light who did similiar pioneering work in his excellent "TDD in ClojureScript" tutorial and corresponding sample/starter application.

As for next steps, my sample project could probably be made into a Leiningen template, making it even easier to get rolling with a new project. Stay tuned...