Skip to content

Add babashka compatibility + migrate tools.cli to parse-opts#356

Merged
lvh merged 12 commits intocloverage:masterfrom
borkdude:cloverage-bb-pr
Feb 28, 2026
Merged

Add babashka compatibility + migrate tools.cli to parse-opts#356
lvh merged 12 commits intocloverage:masterfrom
borkdude:cloverage-bb-pr

Conversation

@borkdude
Copy link
Copy Markdown
Contributor

  • You've updated the changelog (if adding/changing user-visible functionality)

Summary

  • Migrate tools.cli from deprecated cli/cli to cli/parse-opts
  • Bump riddley 0.2.0 → 0.2.2
  • Add babashka compatibility: cloverage's test suite (75 tests) passes on both JVM and babashka

Changes

JVM improvements (commit 1):

  • args.clj: migrate from deprecated cli/cli to cli/parse-opts
  • project.clj: bump riddley 0.2.0 → 0.2.2

Babashka compatibility (commit 2):

  • bb.edn + deps.edn: run tests under babashka with bb test:bb
  • args.clj: if-bb macro for platform-specific code paths
  • coverage.clj: replace .deref ^IDeref with @ (bb compatible)
  • instrument.clj: use (symbol fvar) for var->sym (works on both JVM and bb vars)
  • Test adaptations: if-bb for platform-specific expected values, bb-specific test resources, deftype expansion normalization
  • .gitignore: add clj-kondo/clj-lsp cache entries

Shared Clojure 1.12 tests (commit 3):

  • Qualified methods and functional interface instrumentation tests now run on both JVM and bb
  • Array class syntax test uses if-bb (different method/inlining between platforms)

Tested

  • cd cloverage && lein test — 75 tests, 262 assertions, 0 failures (JVM)
  • cd cloverage && bb test:bb — 75 tests, 240 assertions, 0 failures (bb)

…dley to 0.2.2

- Migrate from deprecated `cli/cli` API to `cli/parse-opts` with `:multi true`
  and `:update-fn conj` for repeated args (replacing `collecting-args-parser`)
- Bump riddley 0.2.0 -> 0.2.2 (adds babashka compatibility)
- Bump tools.cli 0.4.2 -> 1.1.230
- Simplify `var->sym` to use `(symbol fvar)` directly
- Replace `.deref ^IDeref` with `@` in coverage.clj
Add bb.edn and deps.edn for running cloverage tests under babashka.
Adapt source and tests for SCI differences:

- Add `if-bb` macro for conditional test expectations
- Use `(class f)` instead of `.getClass` in fn-sym, filter SCI internal fns
- Skip inlined fn tests on bb (SCI doesn't support inlined functions)
- Skip java interop tests on bb (clojure.lang.RT not available in native bb)
- Normalize deftype expansion in test (bb expands directly to deftype*)
- Add bb-specific expected report snapshots in test/resources/bb/
- Use with-redefs for dependency-sort test on bb (built-in nses lack source)

73 tests, 225 assertions, 0 failures, 0 errors on bb.
73 tests, 247 assertions, 0 failures, 0 errors on JVM.
Qualified methods and functional interface tests are now shared.
Array class syntax test uses if-bb: copyOf for bb (binarySearch not
in bb's reflection config), binarySearch for JVM.
The remove-dynamic-strings regex didn't account for pretty-printed
JSON format (spaces around colon) used by bb's data.json. Normalize
both service_job_id and service_name regardless of whitespace.
@borkdude
Copy link
Copy Markdown
Contributor Author

borkdude commented Feb 17, 2026

@lvh

  • eastwood fails because of ^String/1 since the tools.analyzer it is using doesn't support it. This isn't a new problem, already present on master.
  • lein test-ci fails because of a pre-existing problem on master, something with clojure version and transitive dependencies
  • Fixed newly introduced clj-kondo warnings, but I'm leaving the pre-existing to not make the diff too unwieldy

The rest of the changes should all be related to getting cloverage to run with babashka and should not introduce any new CI failures.

@borkdude
Copy link
Copy Markdown
Contributor Author

Somehow all checks passed now

- Use (symbol (str (.ns v)) (str (.sym v))) instead of (symbol v)
  for Var->symbol conversion, as (symbol var) is not supported on
  Clojure < 1.10
- Move Clojure 1.12 instrument tests to separate test-clj12/ dir
  to avoid reader errors from String/1 syntax on older Clojure
- Make Thread/currentThread test expectation version-aware since
  it macroexpands differently on pre-1.12
Eastwood's bundled tools.reader doesn't support String/1 syntax.
SCI's .sym method on Var returns a namespace-qualified symbol,
causing double-qualification in var->sym. Using .-sym field access
returns just the name, consistent with JVM Clojure.
@borkdude
Copy link
Copy Markdown
Contributor Author

@lvh This PR now fixes a bunch of clojure 1.12 issues as well, CI all green.

@lvh
Copy link
Copy Markdown
Collaborator

lvh commented Feb 28, 2026

This looks great, thanks!

@lvh lvh merged commit cceb55b into cloverage:master Feb 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants