bensu / doo

doo is a library and lein plugin to run cljs.test on different js environments.
Eclipse Public License 1.0
324 stars 63 forks source link

Changing macro requires restarting process and triggering reload #51

Closed exupero closed 6 years ago

exupero commented 8 years ago

I have several macros used by tests, and any time I change one of them, I have to stop the lein doo process and restart it, then (usually) touch my test file so doo recompiles the JS and runs the updated code. If I don't touch the test file, doo seems to use the original macro definition instead of the updated one.

bensu commented 8 years ago

I think this is related to #52 and how the compiler finds/watches macro files. Since this is a little more complex, can you provide an example repo?

exupero commented 8 years ago

I solved #52 by supplying a top-level :source-paths in my project.clj, but doo still doesn't pick up changes to .clj files. Here's an example project demonstrating the problem.

bensu commented 8 years ago

Thanks @exupero , I'll look at it shortly.

bensu commented 8 years ago

I was able to reproduce the behavior without using doo here. I'll see if we can fix this at the compiler level.

Reading this line it is clear why it doesn't work.

bensu commented 8 years ago

Hey @exupero

Macro reloading is not supported by the compiler's api. I think it is an important feature and doo should support it. Since we heavily rely on the compiler's api we will try to add it to the compiler. If that effort fails, we will refactor doo accordingly. In any case, it will take time :(

Sorry for the delay, I'll keep you posted.

exupero commented 8 years ago

Thanks for your work on this. I'm in no urgent need of a fix and can work around the problem until the right solution is found.

bensu commented 8 years ago

Cool, we'll be tracking progress on the compiler front in CLJS-1490.

bensu commented 8 years ago

We got green light to fix this at the compiler level! Will update here any progress.

laurentsenta commented 8 years ago

Note that I encounter this issue with .cljc too, will this fix the issue for both .clj and .cljc?

(thanks for this very handy tool btw)

bensu commented 8 years ago

Hi @lsenta, it seems that if I manage to solve it at the compiler level it should fix the problem for both cljc and clj files.

metasoarous commented 8 years ago

Awesome that you're working on this; Status updates?

I'm working on a bunch of cljs macros, and it's sooo painful...

bensu commented 8 years ago

Hi @metasoarous

We need to go to cljs.build.api/watch and call something like this function when clj and cljc files need to be reloaded. I'll eventually get to it, but I don't know when since I've been super busy lately.

metasoarous commented 8 years ago

OK; Sounds good. Looking forward to it :-)

vemv commented 6 years ago

I'm not experiencing this issue (default config, no magic). I can touch a testing macro and suite will reload.

Issue might have become outdated?

miikka commented 6 years ago

CLJS-1490 has been fixed. Therefore I believe this problem can be solved by upgrading to ClojureScript 1.9.198 or later. I'll close this issue now.