This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-07-12
Channels
- # announcements (2)
- # babashka (22)
- # babashka-sci-dev (15)
- # beginners (62)
- # calva (2)
- # cider (8)
- # clj-kondo (33)
- # clojure (52)
- # clojure-europe (46)
- # clojure-losangeles (1)
- # clojure-norway (5)
- # clojure-spec (7)
- # clojurescript (31)
- # conjure (20)
- # data-science (4)
- # datalevin (16)
- # fulcro (28)
- # hyperfiddle (71)
- # introduce-yourself (3)
- # lsp (50)
- # off-topic (16)
- # polylith (8)
- # portal (3)
- # practicalli (1)
- # reitit (1)
- # releases (2)
- # tools-build (22)
- # vim (8)
- # xtdb (17)
Hi! Question about Neil development with tests, a REPL and Emacs. Something in my workflow feels a bit off, so I’m wondering if I’m doing something wrong.
Previously, I’ve been leaning heavily on a development version of neil as a unix script, and running tests from the command line. I really like this for working with small unix tools — just run the code to see what it does. It’s also really nice for playing with CLI arguments to see how it feels. But it didn’t work too well for me on https://github.com/babashka/neil/pull/179, and I got a stuck.
I’m now trying to lean on tests more heavily. Run the existing tests frequently, and be very explicit about the changes I’m making. Make sure things are testable rather than making the changes first and figuring out how to test them later.
https://github.com/babashka/neil/blob/ece39617404d28f0f0692a1ad24ab711a38a2bae/deps.edn file has a :test
alias that adds "tests"
to the classpath, and adds a test runner dependency. It also sets :main-opts
to run the test runner from the command line. I tried using that alias from a repl, setting cider-clojure-cli-global-options
to "-A:test"
as a dir-local variable. That caused some behavior I didn’t want: it ran the tests (with the test runner), and terminated the REPL.
I see that cognitect-labs/test-runner
also has a similar https://github.com/cognitect-labs/test-runner/tree/7284cda41fb9edc0f3bc6b6185cfb7138fc8a023/deps.edn, a :test
alias that adds dependencies for testing, and sets the main function to run a command.
---
Is there a way to get an editor-connected REPL that has test dependencies and test paths with the current Neil setup?
But how should I start the REPL? Using a plain M-x cider -jack-in
like i normally do, doesn’t add the "test/"
folder to the classpath.
What are you doing when running tests from the REPL? Do you just jack into a JVM repl, evaluate all the forms in the test namespaces, and then use M-x cider-test-run-test
and the likes?
I usually don't use cider to run tests, but just run then manually using clojure.test
I added this to the neil deps.edn for local development:
:dev
{:extra-paths ["test"]
:extra-deps {io.github.cognitect-labs/test-runner
{:git/url ""
:git/tag "v0.5.1"
:git/sha "dfb30dd"}}}
Should we merge it?
It’s a copy of the :test
alias, with :main-opts
and :exec-fn
removed.@U5H74UNSF that was also what I expected! But when I run clj -A:test
in the neil repo, the tests start running:
$ clj -A:test
WARNING: Use of :main-opts with -A is deprecated. Use -M instead.
Running tests in #{"test"}
Testing babashka.neil.dep-add-test
Testing babashka.neil.dep-upgrade-test
[...]