test-refresh
test-refresh copied to clipboard
Readme: Add an example of how to integrate with ultra or eftest
i still could find a way to integrate lein-test-refresh with ultra / eftest together I'd appriciate an example in the readme
thanks a lot Dan
@buzzdan I'm not sure it is possible to use eftest with test-refresh without code changes to test-refresh. Using lein-test-refresh's :changes-only
feature has caused me to not feel the nee for parallel test running.
I'm guessing with ultra you're interested in getting better test reporting? If so, I'd recommend using humane-test-output. It works well.
This article is my current setup (except with older version numbers in it). It sets up humane-test-output and configures lein-test-refresh to suppress noisy clojure.test
output and to only run namespaces that were affected by the previous change.
I didn't have any trouble with using Ultra
& lein-test-refresh
together. Follow Utlra
s readme to add it into the global Leiningen profile.
lein-test-refresh
works fine for me with Ultra
for me but would like to have Eftest
test reporting. Is it possible nowadays?
I have tried use a a report from eftest as explained in https://github.com/jakemcc/lein-test-refresh/blob/70f5ed6206efe74b09b48643291c7cecdcd88321/sample.project.clj#L40
with :test-refresh {:report eftest.report.progress/report}
in my project.clj
(defproject pedestal-todo-list "0.0.1-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.10.1"]
[io.pedestal/pedestal.service "0.5.8"]
;; Remove this line and uncomment one of the next lines to
;; use Immutant or Tomcat instead of Jetty:
[io.pedestal/pedestal.jetty "0.5.8"]
;; [io.pedestal/pedestal.immutant "0.5.8"]
;; [io.pedestal/pedestal.tomcat "0.5.8"]
[ch.qos.logback/logback-classic "1.2.3" :exclusions [org.slf4j/slf4j-api]]
[org.slf4j/jul-to-slf4j "1.7.26"]
[org.slf4j/jcl-over-slf4j "1.7.26"]
[org.slf4j/log4j-over-slf4j "1.7.26"]
[eftest "0.5.9"]]
:plugins [[com.jakemccrary/lein-test-refresh "0.24.1"]]
:test-refresh {:report eftest.report.progress/report}
:min-lein-version "2.0.0"
:resource-paths ["config", "resources"]
;; If you use HTTP/2 or ALPN, use the java-agent to pull in the correct alpn-boot dependency
;:java-agents [[org.mortbay.jetty.alpn/jetty-alpn-agent "2.0.5"]]
:profiles {:dev {:aliases {"run-dev" ["trampoline" "run" "-m" "pedestal-todo-list.server/run-dev"]}
:dependencies [[io.pedestal/pedestal.service-tools "0.5.8"]]
:plugins [[com.jakemccrary/lein-test-refresh "0.24.1"]]}
:uberjar {:aot [pedestal-todo-list.server]}}
:main ^{:skip-aot true} pedestal-todo-list.server)
but I got a Null Pointer Exception error from the REPL:
➜ pedestal-todo-list lein test-refresh
:repositories detected in user-level profiles! [:user]
See https://github.com/technomancy/leiningen/wiki/Repeatability
Using reporter: eftest.report.progress/report
*********************************************
*************** Running tests ***************
:reloading (pedestal-todo-list.service pedestal-todo-list.service-test pedestal-todo-list.server)
INFO org.eclipse.jetty.util.log - Logging initialized @7927ms to org.eclipse.jetty.util.log.Slf4jLog
INFO io.pedestal.http - {:msg "GET /", :line 80}
FAIL in (service_test.clj:11)
expected: "Hello Felipe!"
actual: ("Hello Felip!")
ERROR in (core.clj:2355)
expected: (= (:body (response-for service :get "/")) "Hello Felip!")
actual:
java.lang.NullPointerException:
clojure.core/swap! core.clj: 2355
clojure.core/swap! core.clj: 2345
...
eftest.report.progress/eval20712/fn progress.clj: 49
...
clojure.test/do-report test.clj: 357
pedestal-todo-list.service-test/fn/fn service_test.clj: 11
pedestal-todo-list.service-test/fn service_test.clj: 11
clojure.test/test-var/fn test.clj: 717
clojure.test/test-var test.clj: 717
clojure.test/test-vars/fn/fn test.clj: 735
clojure.test/default-fixture test.clj: 687
clojure.test/test-vars/fn test.clj: 735
clojure.test/default-fixture test.clj: 687
clojure.test/test-vars test.clj: 731
clojure.test/test-all-vars test.clj: 737
clojure.test/test-ns test.clj: 758
clojure.core/map/fn core.clj: 2755
...
clojure.core/apply core.clj: 667
clojure.test/run-tests test.clj: 768 (repeats 2 times)
...
clojure.core/apply core.clj: 665
com.jakemccrary.test-refresh/run-selected-tests/fn test_refresh.clj: 182
com.jakemccrary.test-refresh/suppress-unselected-tests test_refresh.clj: 141
com.jakemccrary.test-refresh/run-selected-tests test_refresh.clj: 180
com.jakemccrary.test-refresh/run-tests test_refresh.clj: 195
com.jakemccrary.test-refresh/monitor-project/fn test_refresh.clj: 302
com.jakemccrary.test-refresh/monitor-project test_refresh.clj: 287
user/eval4225 REPL Input
...
clojure.main/load-script main.clj: 475
clojure.main/init-opt main.clj: 477
clojure.main/initialize main.clj: 508
clojure.main/null-opt main.clj: 542
clojure.main/main main.clj: 664
clojure.main/main main.clj: 616
...
clojure.main.maijava.lang.NullPointerException
n main.java: 40
ERROR in (core.clj:2355)
Uncaught exception, not in assertion.
java.lang.NullPointerException:
clojure.core/swap! core.clj: 2355
clojure.core/swap! core.clj: 2345
...
eftest.report.progress/eval20718/fn progress.clj: 56
...
clojure.test/do-report test.clj: 357
pedestal-todo-list.service-test/fn/fn service_test.clj: 11
pedestal-todo-list.service-test/fn service_test.clj: 11
clojure.test/test-var/fn test.clj: 717
clojure.test/test-var test.clj: 717
clojure.test/test-vars/fn/fn test.clj: 735
clojure.test/default-fixture test.clj: 687
clojure.test/test-vars/fn test.clj: 735
clojure.test/default-fixture test.clj: 687
clojure.test/test-vars test.clj: 731
clojure.test/test-all-vars test.clj: 737
clojure.test/test-ns test.clj: 758
clojure.core/map/fn core.clj: 2755
...
clojure.core/apply core.clj: 667
clojure.test/run-tests test.clj: 768 (repeats 2 times)
...
clojure.core/apply core.clj: 665
com.jakemccrary.test-refresh/run-selected-tests/fn test_refresh.clj: 182
com.jakemccrary.test-refresh/suppress-unselected-tests test_refresh.clj: 141
com.jakemccrary.test-refresh/run-selected-tests test_refresh.clj: 180
com.jakemccrary.test-refresh/run-tests test_refresh.clj: 195
com.jakemccrary.test-refresh/monitor-project/fn test_refresh.clj: 302
com.jakemccrary.test-refresh/monitor-project test_refresh.clj: 287
at clojure.core$swap_BANG_.invokeStatic(core.clj:2355)
at clojure.core$swap_BANG_.doInvoke(core.clj:2345)
at clojure.lang.RestFn.invoke(RestFn.java:497)
at eftest.report.progress$eval20718$fn__20719.invoke(progress.clj:56)
at clojure.lang.MultiFn.invoke(MultiFn.java:229)
user/eval4225 REPL Input
...
clojure.main/load-script main.clj: 475
clojure.main/init-opt main.clj: 477
clojure.main/initialize main.clj: 508
clojure.main/null-opt main.clj: 542
clojure.main/main main.clj: 664
clojure.main/main main.clj: 616
...
clojure.main.main main.java: 40
at clojure.lang.Var.invoke(Var.java:384)
at clojure.test$do_report.invokeStatic(test.clj:357)
at clojure.test$test_var$fn__9737.invoke(test.clj:717)
at clojure.test$test_var.invokeStatic(test.clj:717)
at clojure.test$test_var.invoke(test.clj:708)
at clojure.test$test_vars$fn__9763$fn__9768.invoke(test.clj:735)
at clojure.test$default_fixture.invokeStatic(test.clj:687)
at clojure.test$default_fixture.invoke(test.clj:683)
at clojure.test$test_vars$fn__9763.invoke(test.clj:735)
at clojure.test$default_fixture.invokeStatic(test.clj:687)
at clojure.test$default_fixture.invoke(test.clj:683)
at clojure.test$test_vars.invokeStatic(test.clj:731)
at clojure.test$test_all_vars.invokeStatic(test.clj:737)
at clojure.test$test_ns.invokeStatic(test.clj:758)
at clojure.test$test_ns.invoke(test.clj:743)
at clojure.core$map$fn__5866.invoke(core.clj:2755)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:51)
at clojure.lang.Cons.next(Cons.java:39)
at clojure.lang.RT.boundedLength(RT.java:1792)
at clojure.lang.RestFn.applyTo(RestFn.java:130)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.test$run_tests.invokeStatic(test.clj:768)
at clojure.test$run_tests.doInvoke(test.clj:768)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invokeStatic(core.clj:665)
at clojure.core$apply.invoke(core.clj:660)
at com.jakemccrary.test_refresh$run_selected_tests$fn__868.invoke(test_refresh.clj:182)
at com.jakemccrary.test_refresh$suppress_unselected_tests.invokeStatic(test_refresh.clj:141)
at com.jakemccrary.test_refresh$suppress_unselected_tests.invoke(test_refresh.clj:104)
at com.jakemccrary.test_refresh$run_selected_tests.invokeStatic(test_refresh.clj:180)
at com.jakemccrary.test_refresh$run_selected_tests.invoke(test_refresh.clj:170)
at com.jakemccrary.test_refresh$run_tests.invokeStatic(test_refresh.clj:195)
at com.jakemccrary.test_refresh$run_tests.invoke(test_refresh.clj:184)
at com.jakemccrary.test_refresh$monitor_project$fn__891.invoke(test_refresh.clj:302)
at com.jakemccrary.test_refresh$monitor_project.invokeStatic(test_refresh.clj:287)
at com.jakemccrary.test_refresh$monitor_project.invoke(test_refresh.clj:253)
at user$eval4225.invokeStatic(form-init3440170628018066972.clj:1)
at user$eval4225.invoke(form-init3440170628018066972.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:7177)
at clojure.lang.Compiler.eval(Compiler.java:7167)
at clojure.lang.Compiler.load(Compiler.java:7636)
at clojure.lang.Compiler.loadFile(Compiler.java:7574)
at clojure.main$load_script.invokeStatic(main.clj:475)
at clojure.main$init_opt.invokeStatic(main.clj:477)
at clojure.main$init_opt.invoke(main.clj:477)
at clojure.main$initialize.invokeStatic(main.clj:508)
at clojure.main$null_opt.invokeStatic(main.clj:542)
at clojure.main$null_opt.invoke(main.clj:539)
at clojure.main$main.invokeStatic(main.clj:664)
at clojure.main$main.doInvoke(main.clj:616)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.main.main(main.java:40)
@jakemcc do you have any idea about how could I solve it? 👀
@lipemorais I followed that stack trace and took a look at what that eftest.report.progress/report
is doing and it is trying to reference eftest.report/*context*
and it seems like that is staying with its nil
value instead of having at atom
bound to it as the documentation says. This is happening because it isn't using eftest
's test runner.
You'd need to be able to swap in the runner. This actually already happens for cirleci's runner.
I'm not sure if something similar would work for eftest.
Oh good! Thanks for the explanation. I had the wrong understanding that it would work just because it implementes the parts need from clojure.test.report
. I will try it a little more and if I get any update I can share it here.