-
-
Notifications
You must be signed in to change notification settings - Fork 645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use :main-opts
in -Sdeps
map during jack in with clojure cli
#2941
Comments
repro: deps.edn{:paths ["."]
:aliases
{:test {:extra-paths ["test"]
:extra-deps {lambdaisland/kaocha {:mvn/version "1.0.690"}
lambdaisland/kaocha-cloverage {:mvn/version "1.0.63"}
lambdaisland/kaocha-junit-xml {:mvn/version "0.0.76"}
ring/ring-mock {:mvn/version "0.3.2"}
mockery {:mvn/version "0.1.4"}
http-kit.fake/http-kit.fake {:mvn/version "0.2.1"}}
:main-opts ["-m" "kaocha.runner"]}}} tests.edn{:kaocha/tests [{:kaocha.testable/type :kaocha.type/clojure.test
:kaocha.testable/id :unit
:kaocha/ns-patterns [".*"]
:kaocha/source-paths ["src"]
:kaocha/test-paths ["test"]}]
:kaocha/reporter [kaocha.report/dots]} test/file.clj(ns file
(:require [clojure.test :refer [deftest is]]))
(deftest f (is (= 1 1))) running:
when using
here the -m nrep.cmdline etc are passed as arguments to the kaocha main |
I'm not using the clojure cli, so I'll defer to you on this one. PR welcome! |
EDIT: use Using the
I am unclear why adding to the complexity of the As an aside, as kaocha is not actually used in this example as the repo is only using cider-test. |
The existing functionality is just a direct port of the original injection which was for Leiningen and where such problems simply didn't exist. Whatever got passed over the command-line simply overwrite the other specified deps, which is ideal as it allows CIDER to make sure people are using the right version of nREPL, cider-nrepl, etc. The biggest caveat of the |
kaocha is explicitly used in this example. the profile includes extra deps and a main, as exemplified by the results of You mentioned this example uses "cider test" but I don't know what that is. An alternative approach to make a runner alias is not actually an alternative here as that is exactly what the |
I don't see why we need code to parse aliases. We always use an inline
I'm not following this point. This issue is only under |
I actually not sure I am following the comments from @jr0cket The problem is that any used c.t.d. alias can break the It has nothing to do with kaocha particularly, it is just the example. The approach as (I see it) generate the This way it follows the latest c.t.d. approach and ensures the Maybe I am missing something - but I don't see any complexity with it. Offtopic: |
I may try to make the PR (dont have much elisp experience tho) |
Seems I am unable to make my points clear in this and previous issues and PRs. It seems we don't have a shared view on how to proceed with Clojure CLI support and I haven't been able to communicate my approach or concerns so you understand them, so will retire from this topic and switch to using cider-connect which seems to be a better workflow in the long run and I am not editor dependent. Only read on if you are interested in one more time to try and explain, it's not particularly relevant to the issue, except that we are conflating issues. Kaocha or any test runner is a distracting example as the test runner as that test runner is not called from within Emacs. Running |
@jr0cket Please ignore the kaocha fully, the issue not related to the kaocha at all. the problem is next:
Having this main-opts breaks the cider-jack-in because |
Offtopic
I know, but I want to load the |
Do you see anything in this proposal that will break a functionality of
Its hard to see how kaocha is a distracting example as its the exact use case that prompted this issue. Kaocha is used from the command line using the main args /t/testing ❯❯❯ clj -A:test
WARNING: Use of :main-opts with -A is deprecated. Use -M instead.
[(.)] # this is the output of kaocha's test running
1 tests, 1 assertions, 0 failures. # this is a summary of all tests run by kaocha.
/t/testing ❯❯❯ And similarly run from a repl: ;; Connected to nREPL server - nrepl://localhost:57218
;; Startup: /usr/local/bin/clojure -Sdeps '{:deps {nrepl {:mvn/version "0.8.2"} cider/cider-nrepl {:mvn/version "0.25.4"}}}' -A:test -m nrepl.cmdline --middleware '["cider.nrepl/cider-middleware"]'
user> (require '[kaocha.repl :as k])
nil
user> (k/run :unit)
[(.)]
1 tests, 1 assertions, 0 failures.
#:kaocha.result{:count 1, :pass 1, :error 0, :fail 0, :pending 0}
user>
It's hard to know how to respond to this. The libraries might not be used, but there's often some extra paths (as there was in this example) for tests to be on the classpath. Its true that kaocha is not required for the way CIDER can run tests, but that's not the only way to run tests. And if people have a large testing setup taking advantage of kaocha's ability to mark tests as unit, integration, etc., why should we force them to use CIDER's runner and test selector? The output from kaocha goes into the repl by default, both printing values directly and returning a value of But fundamentally this issue is simply stated: CIDER cannot |
@dpsutton I like your idea, I think @jr0cket is referring mostly to the discussion in #2922 where he suggested a different way to structure the params for Clojure CLI.
Yep, very well summarized. |
I also just ran into this with https://github.com/cognitect-labs/test-runner. I think this is definitely worth solving. |
No argument from me. I'm assuming @dpsutton will tackle this when he has time for it. |
if you jack in with other profiles that include main opts, the cider commandline main opts are ignored. One way around this is to use the merging resolution for multiple profiles: last main-opts "wins".
ie instead of
we can use
this ensures that if any main opts are in
dev
ortest
, thecider/jack-in
alias will win.The motivating example is the following alias:
where a repl is desired with the test library but without running the test lib's main or requiring splitting the main from the necessary dependencies.
The text was updated successfully, but these errors were encountered: