This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-11
Channels
- # adventofcode (52)
- # announcements (3)
- # aws (2)
- # babashka (36)
- # babashka-sci-dev (4)
- # beginners (69)
- # biff (45)
- # calva (9)
- # cider (3)
- # clara (8)
- # clj-kondo (24)
- # clojure (20)
- # clojure-dev (12)
- # clojure-europe (12)
- # clojurescript (2)
- # conjure (1)
- # emacs (17)
- # lsp (69)
- # malli (12)
- # off-topic (32)
- # polylith (2)
- # re-frame (4)
- # releases (2)
- # scittle (6)
- # shadow-cljs (21)
- # tools-deps (10)
- # vim (11)
- # xtdb (11)
Ran into some trouble today trying to pass a negative double as an argument to babashka cli, it was being parsed as a flag. Am I missing something?
A workaround for now is to invoke the CLI with: foo.clj :opt1 bar :opt2 baz
, then it will not try to read flags with a -
prefix
logged the issue here: https://github.com/babashka/cli/issues/53
Thanks! My current workaround was to have separate tasks for deposit
and withdrawal
so the sign was declared in the task which worked for my case
Is this the way to run tests via babashka?
deps.edn
:
:test-runner/babashka
{:extra-deps {io.github.cognitect-labs/test-runner {:git/tag "v0.5.0"
:git/sha "b3fd0d2"}
;; Specifies custom test runner that runs babashka tests without
;; the patching tools.namespace ns: 55:00
org.clojure/tools.namespace
{:git/url ""
:git/sha "3625153ee66dfcec2ba600851b5b2cbdab8fae6c"}}
:main-opts ["-m" "cognitect.test-runner"]}
bb.edn
:
;; bb test-bb
test-bb {:doc "Run tests via bb"
:task (do (println "Running tests via Babashka")
(clojure "-M:project/dev:project/test:test-runner/babashka"))}
It gives me the same execution time as if I'd be running tests in JVM clojure (I used time
command to "measure")I think this blog post will help: https://blog.michielborkent.nl/babashka-test-runner.html
@U028ART884X the way your code is written here would launch a JVM to load the deps from deps.edn and run the tests in that JVM. All bb is doing here is to fork that process, not execute any of the tests "in" bb. Hence the time taken is the same.
Ah right š I'll try to fix it, thanks
How does one include -M
options into the babashka test runner that's described here?
https://blog.michielborkent.nl/babashka-test-runner.html
I'd like to include some resource dirs from a profile from deps.edn
:thinking_face:
bb would only read bb.edn
. you can pass the resources path in :`extra-paths` maybe? in the bb task
I know I can code it into the bb.edn
file. But for instance I could have some new dependencies, JVM args, maybe env args, configs.
Edit: ofc JVM args could probably be irrelevant
what would be an example of things you'd like to pass?
I only don't want to duplicate config in two places. So for instance I'd like to have a dependency that's saved in deps.edn
profile that I only add to tests.
@U028ART884X You can do it programmaticaly using babashka.deps/add-deps
For instance I could have this dependency while running tests but not in main deps config:
pjstadig/humane-test-output {:mvn/version "0.11.0"}
What do you mean by
> you can slurp / edn-parse the deps.edn
yourself and provide a :aliases
argument
Can I do this?
:aliases ["test"]
:aliases
in bb.edn don't get picked up.
So what you suggest is to generate bb.edn's babashka test config? It seems to be not that useful for what it would provide.
I'm confused.
Should I treat babashka as a standalone executable or can I add a JAR to its runtime and run it?
Edit: Well I used malli from babashka just fine, so it's somehow capable to side-load things.
Edit2: probably we'd need to have some kind of clojure -M
command for babashka so that it could load the deps.edn
automatically without a separate script that would produce the bb.edn
options for it (classpath).
so what we could essentially do as bb doesn't read deps.edn implicitly: ā¢ use the babashka.deps/add-deps to add the deps to its class path ā¢ to get these deps, you need to load the deps edn programatically and call the add-deps with the relevant deps ā¢ then execute the tests this is my understanding, maybe borkdude has better ideas š
Or write a babashka script that would duplicate the config for you :thinking_face:
But yes, the easiest thing to do is to duplicate the config because that would mean that you verify each dependency in it. But the downside is that now you have two configs from which both are equally important which is not ideal. And then they have to mean the same thing even though the syntax is different.
This should give you what you need, if you don't want to duplicate. There are no other options at the moment: https://book.babashka.org/#_add_deps
hey folks, Iāve been putting together a babashka tutorial and was hoping to get feedback: https://github.com/braveclojure/babooka. Are there any typos or mistakes of that nature? Is there something youād like to see covered? Is anything unclear? My goal is to get more people using babashka :) (p.s. please donāt share it elsewhere though š I donāt want to share it broadly until I put it on the brave clojure site)
it looks like *command-line-args*
is getting bolded and not showing asterisks š
@U0AQ1R7FG I believe in markdown it doesn't have this problem. Is your original in org mode or asciidoc?
For adoc inline code snippets, if that's what you are doing, I have used:
`+*command-line-args*+
`I think this might be the https://docs.asciidoctor.org/asciidoc/latest/text/literal-monospace/
Cool, thanks! The original is the org mode one