Do not warn about subscriptions being used in non-reactive contexts (#17240)
Force re-frame to stop warning about subscriptions in non-reactive contexts while executing subscription tests (i.e. unit tests using the macro test-helpers.unit/deftest-sub). The net result? No more hundreds of useless warnings in the output of make test. re-frame: Subscribe was called outside of a reactive context. See: https://day8.github.io/re-frame/FAQs/UseASubscriptionInAJsEvent/ The warning is actually useful in production code, but in a subscription test we already know we're never inside a reactive context.
This commit is contained in:
parent
2c52001e22
commit
6ea31695d6
|
@ -51,10 +51,12 @@
|
||||||
(let [~args [sub-name#]]
|
(let [~args [sub-name#]]
|
||||||
(restore-app-db
|
(restore-app-db
|
||||||
(fn []
|
(fn []
|
||||||
~@(clojure.walk/postwalk-replace
|
;; Do not warn about subscriptions being used in non-reactive contexts.
|
||||||
{'cljs.test/testing `testing-subscription
|
(with-redefs [re-frame.interop/debug-enabled? false]
|
||||||
'testing `testing-subscription}
|
~@(clojure.walk/postwalk-replace
|
||||||
body)))))))
|
{'cljs.test/testing `testing-subscription
|
||||||
|
'testing `testing-subscription}
|
||||||
|
body))))))))
|
||||||
|
|
||||||
(defmacro use-log-fixture
|
(defmacro use-log-fixture
|
||||||
"Register log fixture which allows inspecting all calls to `taoensso.timbre/log`.
|
"Register log fixture which allows inspecting all calls to `taoensso.timbre/log`.
|
||||||
|
|
Loading…
Reference in New Issue