How to run automate cljs tests in cider?

Viewed 203

When I run tests in my core_test.clj file in cider, the tests run with no problem whenever I load a buffer, since I have set (cider-auto-test-mode 1). But this doesn't work with the cljs file. I have the following code in core_test.cljs

(ns myapp.core-test
  (:require
   [cljs.test         :refer-macros [is deftest]]))

(deftest my-test
  (testing "Arithmetic"
    (testing "with positive integers"
      (is (= 4 (+ 2 2)))
      (is (= 7 (+ 3 4))))
    (testing "with negative integers"
      (is (= -4 (+ -2 -2)))
      (is (= -1 (+ 3 -4))))))

And upon doing C-k in core.cljs. The test doesn't run. Why is this and how can I make cljs tests automatic too, just like clj tests?

1 Answers

It seems to me it's not supported yet. From the CIDER docs for ClojureScript:

CIDER works well with ClojureScript, but not all CIDER features are available in ClojureScript (yet). For instance, the test runner and debugger are currently Clojure-only features.

There are other options for running CLJS tests automatically in the command line, for instance, using Figwheel, Shadow CLJS or a cljs-test-runner.

Related