10
10
11
11
---
12
12
13
+ ![ clojure-test-example] ( https://github.com/user-attachments/assets/231b8ff4-9402-4f22-b313-7c7b21fe6ae3 )
14
+
15
+ This is a plugin to make working with Clojure tests within Neovim a lot more user-friendly. Here are some of the
16
+ features:
17
+
18
+ + Interactively run tests from anywhere in the project
19
+ + Provides selection UI's for picking namespaces or individual tests
20
+ + Easily re-run previous or failing tests without having to navigate back to test namespaces
21
+ + Provide a more human-readable interface
22
+ + Render exceptions in a more human friendly manner
23
+ + Allow go-to-definition on test reports
24
+ + Go to where an exception was thrown
25
+ + Go to failing tests
26
+ + Allow running hooks before executing tests
27
+ + Save files and or reload changed namespaces
28
+
29
+ See the [ feature demo] ( #feature-demo ) for a quick overview.
30
+
31
+ > [ !WARNING]
32
+ >
33
+ > This is ** very alpha software** . It's built for my personal use, and I am developing it out as I go. Use at your own
34
+ > risk.
13
35
14
36
## Installation
15
37
20
42
" julienvincent/clojure-test.nvim" ,
21
43
config = function ()
22
44
require (" clojure-test" ).setup ()
23
- end ,
24
- dependencies = {
25
- { " nvim-neotest/nvim-nio" },
26
- { " MunifTanjim/nui.nvim" }
27
- }
45
+ end
28
46
}
29
47
```
30
48
31
- Note that currently this requires adding a companion dependency to your REPL:
49
+ #### Neovim Dependencies
50
+
51
+ + [ nui.nvim] ( https://github.com/MunifTanjim/nui.nvim )
52
+ + [ nvim-nio] ( https://github.com/nvim-neotest/nvim-nio )
53
+
54
+ #### Clojure Dependencies
32
55
33
56
[ ![ Clojars Project] ( https://img.shields.io/clojars/v/io.julienvincent/clojure-test.svg )] ( https://clojars.org/io.julienvincent/clojure-test )
34
57
58
+ > [ !NOTE]
59
+ >
60
+ > This plugin currently requires the ` io.julienvincent/clojure-test ` companion clojure dependency to be available on
61
+ > your classpath.
62
+
63
+ Configure an alias in the project or user level deps.edn file to include the appropriate dependencies. For example you
64
+ could modify your ` $XDG_CONFIG_HOME/clojure/deps.edn ` or ` $HOME/.clojure/deps.edn ` file as follows:
65
+
66
+ ``` clojure
67
+ {:aliases
68
+ {:nrepl {:extra-deps {; ; Assuming you already have something like this
69
+ nrepl/nrepl {:mvn/version " 1.0.0" }
70
+ cider/cider-nrepl {:mvn/version " 0.42.1" }
71
+
72
+ ; ; Add the companion dependency
73
+ io.julienvincent/clojure-test {:mvn/version " RELEASE" }}
74
+ :main-opts [" --main" " nrepl.cmdline"
75
+ " --middleware" " [cider.nrepl/cider-middleware]"
76
+ " --interactive" ]}}}
77
+ ```
78
+
79
+ Or alternatively you can include them inline with the following ` clojure ` command
80
+
35
81
``` bash
36
- clojure -Sdeps ' {:extra-deps {io.julienvincent/clojure-test {:mvn/version "RELEASE"}}}' \
37
- -m nrepl.cmdline \
38
- --middleware ' [cider.nrepl/cider-middleware]'
82
+ clojure -Sdeps ' {:deps {nrepl/nrepl {:mvn/version "1.0.0"}
83
+ cider/cider-nrepl {:mvn/version "0.28.5"}
84
+ io.julienvincent/clojure-test {:mvn/version "RELEASE"}}}' \
85
+ -M -m nrepl.cmdline \
86
+ --middleware ' [cider.nrepl/cider-middleware]'
39
87
```
40
88
41
- ## Project Status
89
+ ---
90
+
91
+ #### Why the Clojure dependency?
42
92
43
- This is ** very alpha software** . It's built for my personal use, and I am developing it out as I go. Use at your own risk.
93
+ This plugin currently requires executing a lot of logic on the Clojure side, and it needs to format/parse input and
94
+ output in a way that is easily compatible with the Lua plugin - which requires other transient dependencies.
95
+
96
+ I would like for a future version of this plugin to not require this companion dependency but for the moment it is the
97
+ simplest approach.
44
98
45
99
## Configuration
46
100
@@ -74,7 +128,7 @@ clojure_test.setup({
74
128
75
129
## Usage
76
130
77
- Once installed you can call the various API methods to run and load tests or setup keybindings to do this for you.
131
+ Once installed you can call the various API methods to run and load tests or setup key bindings to do this for you.
78
132
79
133
``` lua
80
134
local api = require (" clojure-test.api" )
@@ -86,6 +140,10 @@ vim.keymap.set("n", "<localleader>tp", api.rerun_previous, { desc = "Rerun the m
86
140
vim .keymap .set (" n" , " <localleader>tl" , api .run_tests_in_ns , { desc = " Find and load test namespaces in classpath" })
87
141
```
88
142
143
+ ## Feature Demo
144
+
145
+ ![ clojure-test-demo] ( https://github.com/user-attachments/assets/d54338b6-de25-4b10-a613-2ec9ee4b984b )
146
+
89
147
## Reload namespaces before run
90
148
91
149
A very useful configuration snippet is to set up a hook to save modified buffers and reload namespaces before running
0 commit comments