rcf
rcf copied to clipboard
Test generation breaks REPL-like experience
In Clojure, setting *generate-tests*
to true
will cause RCF to emit clojure.test/deftest
forms.
deftest
always return nil.
In RCF, it should return the last LHS of body.
(alter-var-root #'hyperfiddle.rcf/*generate-tests* (constantly true))
(alter-var-root #'hyperfiddle.rcf/*enabled* (constantly true))
(ns foo)
(tests 1 := 1)
;; ✅
;; => 1
(clojure.test/run-tests 'foo)
;; ✅
Ran 1 tests containing 1 assertions.
0 failures, 0 errors.
{:test 1, :pass 1, :fail 0, :error 0, :type :summary}
Related to #41
Premise: we want to run RCF in a CI configuration.
Problem: not the CI pipeline but feedback loop latency
The issue is: we want (clojure.test/run-tests 'foo)
to work at the REPL so we can debug the CI pipeline. (We want to test the CI pipeline outside of CI)
It's not a blocker because you can run the tests on a file-by-file basis, or you can use a shell script for CI. But that's a worse experience.
Why would tests work at the REPL but not in CI? Because you changed a bunch of namespaces and now we want to run everything one more time to be sure.
(Workaround: use a shell script to run CI and now you know the 1-2 tests that are broken and can fix at REPL, at the cost of 10 seconds of latency)