60ad7c8a29
Equality checks in tests using = give a bad experience by default on test failures containing nested data structures. We use the cljs.test directive match? from matcher-combinators library to help compare nested structures. The problem with match? is that its default matcher for maps (embeds) can be too permissive, and this causes surprises. Here we upgrade matcher-combinators to latest, where a new matcher called nested-equals is available. This matcher won't allow extra keys in maps. This matcher eliminates the need for manually adding nested equals matchers as we have to do currently. - Upgrades matcher-combinators from 3.8.8 to 3.9.1 (latest as of 2024-07-19) What changes? When asserting in tests, we now have the option to use match-strict? or match?. Both directives are available by integrating with cljs.test. The code implementing the new match-strict? directive was 100% copied from the library matcher-combinators because we need to wrap the expected value ourselves with matcher-combinators.matchers/nested-equals. It's ugly code, but it's how we can integrate with cljs.test/assert-expr. |
||
---|---|---|
.. | ||
README.md | ||
default.nix | ||
deps.json | ||
deps.list | ||
generate.sh |
README.md
Description
This folder contains the scripts and Nix derivations necessary to generate Clojure dependencies for this project.
Usage
Running generate.sh
in a shell that has available shadow-cljs
and clojure
should update the deps.list
and deps.json
files.
Details
By using the following command:
shadow-cljs classpath --force-spawn
We download the necessary JARs into ~/.m2
folder, but also get the classpath printed into standard output.
We skip POM files since they are not necessary, and add edge cases we don't want to handle.
We then use the classpath in combination with contents of ~/.m2
folder to generate the following files:
deps.list
- List of JARs relative to the~/.m2
cache folder.deps.json
- Full list of JARs including their SHAs.
The deps.list
file is just intermediate and for debugging purposes.
The deps.json
is loaded by the derivation in default.nix
and used to produce a derivation that contains all the necessary dependencies:
> grep cljfmt nix/deps/clojure/deps.list
cljfmt/cljfmt/0.6.7/cljfmt-0.6.7.jar
> nix-build --no-out-link -A pkgs.deps.clojure
/nix/store/d7p8r9vhq6z2jmxwakxpcb262wgkc86s-status-mobile-clojure-deps
> DEPS=$(nix-build --no-out-link -A pkgs.deps.clojure)
> find $DEPS -iname 'cljfmt-0.6.7.*'
/nix/store/d7p...86s-status-mobile-clojure-deps/cljfmt/cljfmt/0.6.7/cljfmt-0.6.7.pom.sha1
/nix/store/d7p...86s-status-mobile-clojure-deps/cljfmt/cljfmt/0.6.7/cljfmt-0.6.7.pom
/nix/store/d7p...86s-status-mobile-clojure-deps/cljfmt/cljfmt/0.6.7/cljfmt-0.6.7.jar.sha1
/nix/store/d7p...86s-status-mobile-clojure-deps/cljfmt/cljfmt/0.6.7/cljfmt-0.6.7.jar