Fork me on GitHub
#leiningen
<
2018-02-10
>
mlatu14:02:13

hi guys, I’m having trouble running lein test - it finds 0 tests. I have :test-paths ["src/cljs"] in my project.clj Not sure where to start looking

noisesmith15:02:48

who puts unit tests under src?

noisesmith15:02:42

@mlatu the normal thing is for tests to be under "test" or perhaps in a cljs project either "test-cljs" or "test/cljs"

noisesmith15:02:13

(of course if your test files are actually under the "src/cljs" directory, you have some other issue)

mlatu15:02:20

well, I’m just tinkering so far. Could it be the reason?

noisesmith15:02:45

where are your files with tests in them? are they clj files or cljs files?

mlatu15:02:41

.cljs under the same package/directory. I’ll try to move to test/

noisesmith15:02:57

lein test will never run .cljs files

noisesmith15:02:20

all lein test does is load every clj file under the specified directory, then run all tests that were defined in those files

noisesmith15:02:09

it doesn't even look at cljs files, you probably want one of the cljs unit testing plugins, which will require some setup (should the tests run in node? should they run via rhino or a browser or?)

mlatu15:02:19

simple unit tests so far

noisesmith15:02:49

"simple" isn't enough for cljs - you need something that can execute them, and leiningen needs to know how to set it up - there's no default

noisesmith15:02:20

also in my experience most people's cljs code makes assumptions that break in rhino, node is more compatible with a browser env but still different, and automating a browser from the command line isn't a simple thing (there's things that almost work if you set them up though)

mlatu16:02:24

I was able to run unit tests with lein-doo and slimer

mlatu16:02:31

thanks for pointing into the right direction

noisesmith15:02:46

I hear good things about lein-doo for testing cljs, I set up a custom workflow combining its own cljs building profile and a handler on our http server that loads up and runs all the test cljs code in the browser