Fork me on GitHub

I'm trying split my defmethods into different files, while having the defmulti in a parent file. When google for it the recommendation is using in-ns and the loadfunction. But it doesnt seem to work in cljs


what is the recommended way of doing it in cljs?


you should just use the (ns foo (:require [bar])) style.


Can I share a test between clj and cljs? I have an e-mail spec that relies on a regex, and would like to know that it works both in jvm and js. The way I am trying it now is to have the test in a cljc file, where the clojure test runner just finds it, but I fail to make it visible to my cljs test framework (which is using cljs.test).


how does your cljs test runner find other tests defined in cljs files?


Iv’e tried to require the cljc test file (let’s say :as ct) and then (deftest email ct/email).


@dpsutton Let me check….


why not just add the cljc file to the test runner the same way you add cljs files to the runner?


why the intermediate?


yeah, that might be the problem. The runner uses a regex that matches all test namespaces… However, it is from one of them that I try to sneak in the cljc residing test…


I should do that w/o the intermediate, probably. Thing is I am not super familiar with the code base and it didn’t have anything testing the clojure side of the cljc defined specs before I wrote this one. So I moved this e-mail test to cljc and thought I could have it tested by just referencing it like I did.


It works fine just giving the cljc defined test namespaces to the test runner. Many thanks!!! ❤️