Closed rrudakov closed 10 months ago
I had never seen :paths [:clj-paths]
syntax I believe - could you comment on it?
https://clojure.org/reference/deps_and_cli#_paths it's officially supported in deps.edn
Thanks!
I'll check it around tomorrow.
Feel free to verify if the problem goes away using the traditional syntax (Enrich certainly honors provided aliases)
Yes, if replace aliases with normal strings, it fixes the first problem. But second problem with :test
alias still exists.
Problem 2 is not unique to Enrich, IME - it's very common in tools.deps projects to unintentionally run the tests.
Over the years (when Enrich wasn't on the radar) I always suggested to split your deps.edn into :test and :test-runner. That way one can e.g. pick an alternative runner.
In general, the best practice is to keep aliases fine-grained - more so than the average Lein project, for instance.
Otherwise I'd be hesitant about 'fixing' this - Enrich supports custom main
programs so here, most likely it's doing what you're telling it to do.
Hm, but why I can successfully jack-in with :test
alias enabled when cider-enrich-classpath
is nil
? I would expect it to fail as well then?
Enrich supports a broader set of use cases e.g. running it from the terminal, where it's more common to specify a main program (e.g. for specifying a repl - there are a few possible choices).
We may be able to hack something, but I think that nudging users into best practices also is a good idea.
OK. I've been using :test
alias with main-opts
for a while without any issues. What's the best way to split it?
{:test {:extra-paths ["test"]
:extra-deps {io.github.cognitect-labs/test-runner {:git/tag "v0.5.1" :git/sha "dfb30dd"}}}
:test-runner {:main-opts ["-m" "cognitect.test-runner"]
:exec-fn cognitect.test-runner.api/test}}
If I split it like this I won't be able to run :test-runner
without specirying :test
additionaly (because of dependencies).
Or should I duplicate all dependencies in both :test
and :test-runner
aliases? Maybe you have some good article on the topic?
Thanks for the willingness!
I'd suggest to
:test
io.github.cognitect-labs/test-runner
and "-m" "cognitect.test-runner"
under :test-runner
This has the advantages of:
:test
without duplication or conflicts.Maybe you have some good article on the topic?
Not really but probably it's easy enough to see how this is a design that favors composition - often valued in Clojure.
The latest Enrich supports the paths-as-aliases feature.
The issue related to :main-opts
will remain as-is for the time being. I'm reasonably confident that we can foster the described, better pattern.
Cheers - V
Good enough for me :) Thank you!
Steps to reproduce the problem
deps.edn
src/core.clj
(content is not relevant)test/core_test.clj
(content is not relevant)Expected behavior
I can successfully jack-in without
:test
alias or with:test
alasActual behavior
If I jack-in with default aliases (using normal
cider-jack-in
command), the REPL is running successfully, but my namespaces are not included to the classpath. The following command is generated byclojure.sh
(src
path is missing):If I jack-in with custom
:test
alias (either by modifyingcider-clojure-cli-aliases
to":test"
or by using prefix argument and edit start server command replacing-M:cider/nrepl
with-M:test:cider/nrepl
at the end) REPL won't start. Instead I see in the*Messages*
buffer the output of running tests:Running tests in #{"test"}
Testing core-test
Ran 1 tests containing 1 assertions. 0 failures, 0 errors. ("finished")
Environment & Version information
CIDER version information
Lein / Clojure CLI version
Clojure CLI 1.11.1
Emacs version
GNU Emacs 29.1.90 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2023-10-23
Operating system
6.6.1-arch1-1 GNU/Linux
JDK distribution