Olical / conjure

Interactive evaluation for Neovim (Clojure, Fennel, Janet, Racket, Hy, MIT Scheme, Guile, Python and more!)

Home Page:https://conjure.fun

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Clojure] Defining custom/alternative test runner

NoahTheDuke opened this issue · comments

Hey Ollie!

I'm experimenting with an alternative to clojure.test and I'd like to be able to run the tests from within Conjure. I know that kaocha is built-in but that required modifying Conjure itself. If I wanted to make my own Conjure test runner, could I do this from my dotfiles? Maybe some method of altering conjure.client.clojure.nrepl.action/test-runners or related functions to hook in my own stuff?

If this seems reasonable or interesting, I can develop a patch to make this work.

Thanks so much!

We could probably get away with just making that variable public so users could modify it orrr integrating those values into the config system although that might be a bit awkward to do since it has to fit into vim global variables which has a history of not being that great. A lua table a user can require and modify might be better.

I like the idea though yeah! If you want to give it a shot please feel free!

commented

Using the develop branch, the below works great!

local runners = require("conjure.client.clojure.nrepl.action")

runners["test-runners"].lazytest = {
  ["namespace"] = "lazytest.runner.console",
  ["all-fn"] = "run-all-tests",
  ["ns-fn"] = "run-tests",
  ["single-fn"] = "run-test-var",
  ["default-call-suffix"] = "",
  ["name-prefix"] = "#'",
  ["name-suffix"] = "",
}

vim.g["conjure#client#clojure#nrepl#test#runner"] = "lazytest"
vim.g["conjure#client#clojure#nrepl#test#current_form_names"] = { "describe" }

I suspect there's a smoother way to do it, but for me, this is really solid.

commented

Given that this works so well, want me to add a section to the docs about it?

Ohh that'd be great actually, could start with a wiki page? I feel like that'll be better than help text for this since it's a bit more involved than just setting a variable to a number/string in nvim global variables. Thanks!

commented

I've added it here. Edit as you desire!