Skip to content

Commit a73f369

Browse files
committed
Update README with examples and documentation
1 parent 4a7f13e commit a73f369

File tree

1 file changed

+70
-12
lines changed

1 file changed

+70
-12
lines changed

README.md

+70-12
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,28 @@
1010

1111
---
1212

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.
1335
1436
## Installation
1537

@@ -20,27 +42,59 @@
2042
"julienvincent/clojure-test.nvim",
2143
config = function()
2244
require("clojure-test").setup()
23-
end,
24-
dependencies = {
25-
{ "nvim-neotest/nvim-nio" },
26-
{ "MunifTanjim/nui.nvim" }
27-
}
45+
end
2846
}
2947
```
3048

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
3255

3356
[![Clojars Project](https://img.shields.io/clojars/v/io.julienvincent/clojure-test.svg)](https://clojars.org/io.julienvincent/clojure-test)
3457

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+
3581
```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]'
3987
```
4088

41-
## Project Status
89+
---
90+
91+
#### Why the Clojure dependency?
4292

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.
4498

4599
## Configuration
46100

@@ -74,7 +128,7 @@ clojure_test.setup({
74128

75129
## Usage
76130

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.
78132

79133
```lua
80134
local api = require("clojure-test.api")
@@ -86,6 +140,10 @@ vim.keymap.set("n", "<localleader>tp", api.rerun_previous, { desc = "Rerun the m
86140
vim.keymap.set("n", "<localleader>tl", api.run_tests_in_ns, { desc = "Find and load test namespaces in classpath" })
87141
```
88142

143+
## Feature Demo
144+
145+
![clojure-test-demo](https://github.com/user-attachments/assets/d54338b6-de25-4b10-a613-2ec9ee4b984b)
146+
89147
## Reload namespaces before run
90148

91149
A very useful configuration snippet is to set up a hook to save modified buffers and reload namespaces before running

0 commit comments

Comments
 (0)