rcf icon indicating copy to clipboard operation
rcf copied to clipboard

Test generation breaks REPL-like experience

Open ggeoffrey opened this issue 2 years ago • 4 comments

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}

ggeoffrey avatar Sep 30 '21 09:09 ggeoffrey

Related to #41

ggeoffrey avatar Jan 05 '22 12:01 ggeoffrey

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)

dustingetz avatar Jan 14 '22 12:01 dustingetz

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.

dustingetz avatar Jan 14 '22 12:01 dustingetz

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)

dustingetz avatar Jan 14 '22 12:01 dustingetz