This is what we did to make it work.
First we installed Node.js, and then, Karma and its CLI following these instructions.
Once we had that, we added the doo plugin to the project.clj.
Next, we created a new namespace for the unit tests in the tests directory, and set up the test build in project.clj (we called the new namespace unit-tests):
Notice that in the setup you’ve to define which namespace will be used as the main of the unit tests:
In that namespace, we used doo to run the tests and register the namespaces containing unit tests:
Every time a new namespace containing unit tests is added, it has to be registered using the doo-tests macro in order to include it in the run.
Finally, to run the tests on Node.js we added it as a target to the build setup in project.clj:
Notice the addition of
:target :nodejsto the compiler options.
Then we could run our tests writing
lein doo node unit-testson the console:
By default, doo watches the files in the source paths that we indicated in the build setup:
:source-paths ["src/cljs" "test"], so any change to a file in them, makes the unit test run again.
You can check the code in this repository.