Testing your application with cljs.test
In this section, we'll take a look at how to configure your ClojureScript application or library for testing. As usual, we'll start by creating a new project for us to play around with:
$ lein new figwheel testing
Unlike previous examples where we spent most of our time in the src
directory, we'll play around in a test
directory this time. Most JVM Clojure projects will have one already, but since the default Figwheel template doesn't include one, let's make one first (following the same convention used with source directories, that is, instead of src/$PROJECT_NAME
, we'll create test/$PROJECT_NAME
):
$ mkdir -p test/testing
We'll now want to make sure that Figwheel knows to watch the test
directory for file modifications. To do that, we will edit the dev
build in our project.clj
project's :cljsbuild
map so that its :source-paths
vector includes both src
and test
. Your new dev
build configuration should look like this:
{:id "dev" :source-paths...