This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-14
Channels
- # beginners (53)
- # cider (10)
- # cljs-dev (23)
- # cljsrn (25)
- # clojure (68)
- # clojure-italy (4)
- # clojure-spec (25)
- # clojure-uk (7)
- # clojurebridge-ams (1)
- # clojurescript (10)
- # cursive (20)
- # datomic (21)
- # duct (4)
- # fulcro (1)
- # graphql (4)
- # hoplon (1)
- # java (7)
- # luminus (9)
- # off-topic (111)
- # om-next (2)
- # onyx (14)
- # re-frame (3)
- # reagent (9)
- # shadow-cljs (182)
- # test-check (32)
- # tools-deps (53)
- # uncomplicate (1)
- # vim (94)
- # yada (2)
I've pushed this up in replant
, you can see it working on https://github.com/juxt/edge when using replant's "work-anywhere reset" (`<localleader>rf`)
https://ibin.co/3yN4fHRnBfa1.png
Combined with aviso's pretty (using eval
) this could be quite useful, but I'm not sure yet 🙂
heya guys — has anyone been able to get vim-fireplace to work with a .cljs file and nrepl?
i’ve been trying shadow-cljs which provides an nrepl, and also uses piggieback to wrap that nrepl so in theory I should be able to connect from vim -> .clj file connet to nrepl -> eval piggieback -> .cljs file eval buffers
1) start nrepl server 2) connect to js environment (via browser) 3) do some sort of piggieback on the nrepl to go from clj -> cljs
shadow’s nrepl provides all the middleware for cider as well as cemerick.piggieback’s cljs-repl
but it’s like my vim-fireplace just refuses to work in any .cljs buffer — though I can connect and evaluate both clj and cljs environments from a .clj buffer
1) start a shadow server
2) from inside a .clj buffer connect via :Connect <nrepl://localhost:port>
3) I can now use :Eval (+ 1 2)
and get 3 (yay the connection to nrepl works)
4) cannot use :Eval
from inside a .cljs buffer (always spits out Fireplace: class clojure.lang.Compiler$CompilerException
)
5) from a .clj buffer run shadow...api/watch :app
— get back :watching
— success!
6) connect to the js environment by opening a browser
7) still no Eval in a .cljs buffer
8 ) from a clj buffer run shadow...api/nrepl-select :app
— get back [:selected :app] — success!
9 ) from a clj buffer :Eval (js/alert)
yay it works
10 ) still nothing works from a .cljs buffer
it looks like the short-order is : nrepl -> connect -> open js in browser -> piggieback app -> bingo
@eraserhd I'm starting on a test -> quickfix runner for replant. Hopefully it will scratch your itch.
gah, I'm gonna have to make some changes on the cider-nrepl side, the only thing they report when there's a failure is "api_test.clj", like that's useful
@eraserhd is this the sort of thing you were after? https://ibin.co/3yOGqZ3ZVIHo.png
So, for every var tested, I have to send a round-trip op to get the file for the var 😔
https://ibin.co/w800/3yOVtTK4bMMy.png Quite pleased, the diffing is a nice improvement over fireplace: https://ibin.co/w800/3yOWLZV1nauw.png
@dominicm trying out replant today, and was wondering how you got the diff part in the first screenshot?
my test:
(deftest testertester
(testing "Another thing"
(is (= {:foo "bar" :baz "bars"}
{:foo "bar" :baz "bar"})))
(testing "Another thing"
(is (= {:foo "bar" :baz "bars"}
(throw "test"))))
)
@U0510902N that should just work, it did where I tried it. What are you getting?
and I get
test/app/model/test_test.clj|8 warning| app.model.test-test/testertester
|| Testing Another thing
|| expected
|| (= {:foo "bar", :baz "bars"} {:foo "bar", :baz "bar"})
|| actual
|| (not (= {:foo "bar", :baz "bars"} {:foo "bar", :baz "bar"}))
test/app/model/test_test.clj|11 error 1| app.model.test-test/testertester
|| Testing Another thing
|| expected
|| (= {:foo "bar", :baz "bars"} (throw "test"))
|| exception message
|| java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Throwable
|| To inspect stacktrace, run: :ReplantTestStacktrace app.model.test-test testertester 1
like this?
(deftest testertester
(is (= {:foo "bar" :baz "bars"}
{:foo "bar" :baz "bar"}))
(is (= {:foo "bar" :baz "bars"}
(throw "test")))
)
|| expected
|| (= {:foo "bar", :baz 1} {:foo "bar", :baz 2})
|| actual
|| (not (= {:foo "bar", :baz 1} {:foo "bar", :baz 2}))
I run against 0.17.0-SNAPSHOT, so it might be that diffing is new, or recently-fixed
|| expected
|| {:foo "bar", :baz 3}
|| actual
|| {:foo "bar", :baz 4}
|| diff
|| - {:baz 3}
|| + {:baz 4}
one question, if I do :ReplantTestProject
after editing and saving my test, it doesn't pick it up
I do the fireplace cpr
and then :ReplantTestProject
and that works, but runs the tests twice
I think cpr
is a bit magic and requires the current namespace before running. That may or may not work in some circumstances. I was doing a combination of ,rf
and cpaF
as appropriate, yep.
I wonder if it should refresh before running tests, automatically? Something to consider for sure.
a full refresh might be too heavy handed, feel free to open an issue for discussion. I want to think on this one a little more than other things, because I think there's a high risk of breaking people's systems.
Oh, interesting. I don't know if cider supports that yet. I wonder if it's even possible :thinking_face:
however, it's hard to know if that will be sufficient, because what if I changed code somewhere else that makes the test work
Anyway, we can try and get to the bottom of this in the issue, where it's permanently recorded 🙂
https://github.com/SevereOverfl0w/vim-replant/issues/16 I opened this for discussion. I tried to be thorough.
Replant augments fireplace, if you don't like it, don't run the commands and keep using the fireplace ones.
Replant augments fireplace, if you don't like it, don't run the commands and keep using the fireplace ones.