Unit testing clojurescript单元测试建议
正在尝试使用clojurescript设置基本单元测试。查看: 在我的Unit testing clojurescript单元测试建议,unit-testing,clojure,clojurescript,figwheel,Unit Testing,Clojure,Clojurescript,Figwheel,正在尝试使用clojurescript设置基本单元测试。查看: 在我的project.clj文件中,我有: :cljsbuild { :builds [{:id "dev" :source-paths ["src" "test"] :figwheel { :on-jsload "my-proj.core/on-js-reload" } :c
project.clj
文件中,我有:
:cljsbuild {
:builds [{:id "dev"
:source-paths ["src" "test"]
:figwheel { :on-jsload "my-proj.core/on-js-reload" }
:compiler {:main figreag.router
:asset-path "js/compiled/out"
:output-to "resources/public/js/compiled/my_proj.js"
:output-dir "resources/public/js/compiled/out"
:source-map-timestamp true }}
主要的一点是我将“test”添加到:源路径中
然后在:test/my proj/tests.cljs
I中:
(ns ^:figwheel-always my-proj.tests
(deftest all-tests
(run-tests 'my-proj.core-test)
(run-tests 'my-proj.util-test))
然后在我的REPL中执行(运行测试)
。这是惯用的方式吗?很明显,我也在使用figwheel。这有一个问题,即REPL没有完全接受对测试的编辑。这会扼杀紧凑的迭代。可能必须杀死REPL,执行lein clean
,然后重新启动REPL以获取测试更改。不好玩!:)重新定义测试函数是可以的,但是除非卸载名称空间,否则删除测试函数是不起作用的。虽然您也可以在js reload上使用
回调到(运行测试)
,对吗?这有一个问题,即REPL没有完全接受对测试的编辑。这会扼杀紧凑的迭代。可能必须杀死REPL,执行lein clean
,然后重新启动REPL以获取测试更改。不好玩!:)重新定义测试函数是可以的,但是除非卸载名称空间,否则删除测试函数是不起作用的。虽然您也可以在js重新加载时使用
回调(运行测试)
,对吗?