Fork me on GitHub
#cider
<
2023-01-27
>
RAJKUMAR23:01:23

how can I run single test in emacs using cider

RAJKUMAR23:01:14

I'm using emacs as clojure development environment. My emacs config is https://github.com/rajcspsg/emacs.d

RAJKUMAR23:01:26

I'm trying to run single test in my clojure project.

RAJKUMAR23:01:48

I've test file called core-test in the folder test/getting-started/core-test.clj folder. The contents of the file is -

RAJKUMAR23:01:57

(ns getting-started.core-test
  (:require [clojure.test :refer :all]
            [getting-started.core :refer :all]))

(deftest a-test
  (testing "FIXME, I fail."
    (is (= 0 0))))

dpsutton00:01:56

hi @U02PR896TMG. I think I see a few issues:

dpsutton00:01:41

• filenames must use hyphens. getting-started folder needs to be getting_started. So the full path of your file should be test/getting_started/core_test.clj. This is a JVM limitation. The ns form is correct: use hyphens in the ns name. • You have to require the namespace for everything to run. Clojure works based on repl state, not just file tree state. So make sure you run cider-load-buffer and then try again.

RAJKUMAR01:01:43

cider-load-buffer did the trick

RAJKUMAR01:01:59

now I can run clojure tests like a charm

RAJKUMAR23:01:08

I would like to run this single test a-test. I started cider using command cider-jack-in. Now I'm trying to run single test using command M-x cider-test-run-test.

RAJKUMAR23:01:24

Now I'm getting warning no test at point

RAJKUMAR23:01:55

Any help on this is appreciated

Zed04:01:50

Does running cider-load-buffer help?

bozhidar12:01:43

I was going to suggest the same.

bozhidar12:01:03

Generally everything about tests is well documented here https://docs.cider.mx/cider/testing/running_tests.html (including common caveats)

RAJKUMAR15:01:49

Let me check this. Thanks @U051BLM8F