How To Run Clojurescript Unit Tests with Figwheel?

194 Views Asked by At

I'm attempting to use my figwheel REPL to run unit tests but I can't seem to get them to work. I've tried several different things, but each time I get a variety of errors usually related to not having (run-tests) defined.

My test file is as follows in /tests

(ns ^:figwheel-always story-planner.tests.test
  (:require [cljs.test :refer-macros [deftest is testing run-tests]]))



(deftest test-numbers
  (is (= 1 1)))

I've tried with and without the fighweel-always which i got from another question here. I've also updated my project.clj:

:cljsbuild {:builds
              [{:id "dev"
                :source-paths ["src" "tests"]
...

But no luck. I've also tried (in-ns) into my namespace but it still gives me run-tests not found doing it that way.

I'm sure I'm missing something easy, but I'm banging my head here not sure what the issue is. My end goal is simply to get my unit tests running manually for now, and I can build on that later.

1

There are 1 best solutions below

0
Alan Thompson On

IMHO, I would recommend switching from lein to figwheel-main and Clojure Deps builds for all future CLJS work, including unit tests.

https://figwheel.org